Download presentation
Presentation is loading. Please wait.
Published bySilvester Boyd Modified over 8 years ago
1
Sales Demo
2
Demo Overview RDF and Triples D2RQ Overview and Setup Ontology and Mappings Sales Demo Model Inferencing
3
RDF and Triples Subject, Predicate, Object
4
D2RQ As Semantic Web technologies are getting mature, there is a growing need for RDF applications to access the content of huge, live, non-RDF, legacy databases without having to replicate the whole database into RDF. The D2RQ mapping language for treating non- RDF relational databases as virtual RDF graphs, and the D2RQ Platform that enables applications to access these graphs through the Jena and Sesame APIs, as well as over the Web via the SPARQL Protocol and as Linked Data. JenaSesameSPARQL ProtocolLinked Data
5
D2RQ Setup Create Mappings Review Generated Ontology Review Generated RDF
6
DB Model (TODO: place datamodel diagram here)
7
Create Mappings To create the d2rq mappings and run from the location d2rq was downloaded. generate-mapping -o salesdemoExample.n3 -d com.mysql.jdbc.Driver jdbc:mysql://127.0.0.1/salesdemo dump-rdf -m salesdemo.n3 -f N3 -o salesdemoExample.n3 -b http://salesdemo/
8
Generated Ontology map:database a d2rq:Database; d2rq:jdbcDriver "com.mysql.jdbc.Driver"; d2rq:jdbcDSN "jdbc:mysql://127.0.0.1/salesdemo"; jdbc:autoReconnect "true"; jdbc:zeroDateTimeBehavior "convertToNull";
9
Generated Ontology # Table employees map:employees a d2rq:ClassMap; d2rq:dataStorage map:database; d2rq:uriPattern "employees/@@employees.ID@@"; d2rq:class vocab:employees; d2rq:classDefinitionLabel "employees"; map:employees_ID a d2rq:PropertyBridge; d2rq:belongsToClassMap map:employees; d2rq:property vocab:employees_ID; d2rq:propertyDefinitionLabel "employees ID"; d2rq:column "employees.ID"; d2rq:datatype xsd:int; References database used in 2rq:Database Class References metadata about field in table Used as Subject in Sparql Query
10
Generated RDF a vocab:employees ; rdfs:label "employees #2" ; vocab:employees_ADDRESS_ID "2"^^xsd:int ; vocab:employees_AGE "31"^^xsd:int ; vocab:employees_FNAME "Rodney" ; vocab:employees_GENDER "M" ; vocab:employees_ID "2"^^xsd:int ; vocab:employees_LNAME "Mckee" ; vocab:employees_MNAME "Stephen".
11
Simple Filtering (By State) String vocab = "http://localhost:2020/vocab/resource/"; Node predicate = Node.createURI(vocab + "address_STATE_CD"); Node object = Node.createLiteral("PA"); Model result = SalesModelFactory.createFilteredModel(m, Triple.createMatch(Node.ANY, predicate, object)); result.write(System.out, FileUtils.langN3); "PA". "PA".
12
Sparql (by State) PREFIX xsd: PREFIX rdfs: PREFIX rdf: PREFIX owl: PREFIX vocab: SELECT DISTINCT ?subj ?id ?stateCD WHERE { ?subj vocab:address_STATE_CD ?stateCD. ?subj vocab:address_ID ?id. FILTER (?stateCD = str(?code)). }
13
Sparql Filtering String result = SalesModelFactory.createFilteredModel(m, SparqlConstants.QUERY_ALL); http://salesdemo/products/2 http://localhost:2020/vocab/resource/products_SUGGESTED_PRICE 209.99
14
Inferencing
15
Linked Open Data
16
Related Links http://www4.wiwiss.fu- berlin.de/bizer/D2RQ/spec/ http://sourceforge.net/projects/d2rq-map/
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.