Professional Documents
Culture Documents
Jena Seminar
Jena Seminar
CONTENTS
Gii thiu Eclipse Java Editor
Kin trc Eclipse Ci t Eclipse Vit chng trnh Java bng Eclipse Thm cc th vin ca Jena vo Eclipse Tng quan v Jena Cu trc Jena 2 Cc lp chnh To mt RDF Graph Read/Write RDF File
ECLIPSE?
Eclipse l phn mm min ph, c cc nh pht
Platform,
Java Development Toolkit (JDT), Plug-in Development Environment (PDE)
vo Eclipse Platform
ECLIPSE?
Eclipse Platform l nn tng ca ton b phn mm
Eclipse, mc ch ca n l cung cp nhng dch v cn thit cho vic tch hp nhng b cng c pht trin phn mm khch di dng Plug-in . JDT cng c th c coi nh l mt Plug-in lm cho Eclipse nh l mt Java IDE (Integrated Development Enviroment).
ni m plug-in cn.
Pug-in ch c ti vo Eclipse mi khi thc s cn
The Workspace
Workspace chu trch nhim qun l ti nguyn ngi
The Workbench
Workbench l giao din ha ngi dng ca
hay Jface lp trnh giao din, c th s dng AWT hay SWING ca Java thng qua vic ci t cc Plugins
Team support
Trang b h thng qun tr qun l d n ca ngi
Team support
Cung cp h thng ti liu m rng, c th l nh
CI T ECLIPSE
Trc ht bn ti Eclipse (Classic) v t a ch :
http://www.eclipse.org/downloads/
Gii nn tp tin Eclipse SDK vo th mc m bn
mun ci t (V d : C:\Eclipse).
Chp th mc JRE ca JDK vo th mc con ca th
mc Eclipse
Sau , chy tp tin eclipse.exe hon thnh ci t
dng web ng ngha Website: http://jena.sf.net Cung cp mt mi trng lp trnh cho RDF, RDFS and OWL, SPARQL Bao gm cc cng c suy din t cc lut c s (rulebased inference engine) Open source Phin bn u tin ra i 2000 do HP Lab xy dng Jena 2 ra i vo 2003 phin bn hin ti l Jena 2.5.6
ba cc node
Kin trc ca Jena c thit k
cho php tch hp mt cch d dng cc thnh phn x l c th thay th nh b phn tch d liu (parser), xut bn (writer), lu tr v truy vn
Jena API bao gm mt tp cc giao din Java m t cc ngun
ti nguyn (resources), cc thuc tnh (properties), cc pht biu (statements) v cc m hnh (model) di dng khung m t ti nguyn RDF (Resource Description Framework)
Cc interfaces ca Jena2
b ba RDF {predicate, subject, object} Literal interface : Dng m t cc chui v chuyn i mt s kiu ca Java nh String, Int, v Double Cc i tng hin thc giao din Property c th l mt predicate trong b ba {predicate, subject, object} Statement interface: m t b ba {predicate, subject, object}. ng thi n cng c th c dng nh mt i tng Cc i tng hin thc cc giao din Container, Alt, Bag, hoc Seq c th l i tng
TO RDF GRAPH
Kin trc Jena tp trung vo m hnh RDF (RDF
model). Trong Jena mt lc RDF c gi l mt Model v c m t bi giao din Model. ModelFactory cung cp cc method to mt dng Model chun V d:
TO RDF GRAPH
S dng createDefaultModel() to mt RDF Model
Model model = ModelFactory.createDefaultModel();
to mt Resource:
Resource johnSmith = model.createResource(personURI);
biu (statement). Mi pht biu ny c thm vo RDF Model bng phng thc addProperty:
johnSmith.addProperty(VCARD.FN, fullName);
TO RDF GRAPH
Kt qu xut ra console:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntaxns#" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#" > <rdf:Description rdf:about="http://somewhere/JohnSmith"> <vcard:FN>John Smith</vcard:FN> </rdf:Description> </rdf:RDF>
TO RDF GRAPH
V d 2:
Blank node
TO RDF GRAPH
Kt qu xut ra dng RDF/XML:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#" > <rdf:Description rdf:about="http://somewhree/JohnSmith"> <vcard:N rdf:nodeID="A0"/> <vcard:FN>JohnSmith</vcard:FN> </rdf:Description> <rdf:Description rdf:nodeID="A0"> <vcard:Given>John</vcard:Given> <vcard:Family>Smith</vcard:Family> </rdf:Description> </rdf:RDF>
TO RDF GRAPH
Statements Mt statement gm 3 phn
ba) Mt model l mt tp cc statement Jena model cung cp phng thc listStatement() vi gi tr tr v l StmIterator ( mt danh sch cc statement trong model )
TO RDF GRAPH
V d 3
Kt qu :
http://somewhree/JohnSmith http://www.w3.org/2001/vcard-rdf/3.0#N 207df7e5:11d4b6fc7da:-8000 http://somewhree/JohnSmith http://www.w3.org/2001/vcard-rdf/3.0#FN JohnSmith -207df7e5:11d4b6fc7da:-8000 http://www.w3.org/2001/vcard-rdf/3.0#Given John -207df7e5:11d4b6fc7da:-8000 http://www.w3.org/2001/vcard-rdf/3.0#Family Smith