160 likes | 170 Views
This article discusses the implementation and usage of named graphs in RDF datasets, with a focus on the SPARQL query language. It covers topics such as graph manipulation, serialization, versioning, and provenance. Examples and use cases are provided.
E N D
W3C Technical Plenary Boston, 28 February 2005 Named Graphs meet SPARQL Chris Bizer, Freie Universität Berlin, GermanyJeremy Carroll, Hewlett-Packard Labs, UK Pat Hayes, IHMC, USA Patrick Stickler, Nokia, Finland
SPARQL Version 20050217 SELECT ?company ?rating WITH local:trustedInformation local:crawlerMonday local:crawlerTuesday FROM website1:graph1 website1:graph2 website2:graph1 website2:graph2 WHERE ( ?g dc:publisher ?name ) ( ?name tpl:trustedBy local:Me ) GRAPH ?g { ( ?company fin:rating ?rating ) ( ?company fin:sector fin:banking ) }
RDF Dataset versus Named Graphs Named Graphs RDF Dataset BackgroundGraph
Agenda • Implementing Named Graphs • NG4J – Named Graphs API for Jena • Jena - Multimodel • TriX and TriG Syntax • Signing Named Graphs • Semantic Web Publishing Vocabulary (SWP) • Use Cases • Versioning and Provenance
NG4J – Named Graphs API for Jena • Extension to the Jena semantic web toolkit • APIs for manipulating sets of Named Graphs • Memory and database backed storage • TriQL query language • Serialization using TriX, TriG and collections of RDF/XML files • SWP API for signing graphs • Available under BSD license
NG4J’s APIs • Named Graph API • NamedGraph graph = graphset.createGraph(graphname); • graph.add(triple); • Quad API • graphset.addQuad(quad); • Provenance enabled Jena Model API • Model model = graphset.asJenaModel("http://example.org/defaultgraph"); • iterator = jenaStatement.listGraphNames(); • provides migration path for existing applications
TriX • Straight forward XML serialization of the abstract syntax • allows the usage of generic XML tools like XSLT or XQuery <TriX xmlns="http://www.w3.org/2004/03/trix/trix-1/"> <graph> <uri>http://www.bizer.de/InformationAboutRichard</uri> <triple> <uri>http://richard.cyganiak.de/foaf.rdf#RichardCyganiak</uri> <uri>http://xmlns.com/foaf/0.1/mbox</uri> <uri>mailto:richard@cyganiak.de</uri> </triple> </graph> <graph> <uri>http://www.bizer.de/ProvenanceInformation</uri> <triple> <uri>http://www.bizer.de/InformationAboutRichard</uri> <uri>http://purl.org/dc/elements/1.1/author</uri> <plainLiteral>Chris Bizer</plainLiteral> </triple> </graph></TriX>
TriG • based on Turtle, extended with graph naming @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix ex: <http://www.example.org/vocabulary/> . @prefix : <http://www.example.org/exampleDocument/> . :G1 { _:Monica ex:name "Monica Murphy" . _:Monica ex:email <mailto:monica@murphy.org>. :G1 ex:disallowedUsage ex:Marketing } :G2 { :G1 ex:author :Chris . :G1 ex:date "2003-09-03"^^xsd:date }
TriX, TriG and SPARQL Protocol getGraph() • GET /qps?graph=2.rdf&graph=4.rdf HTTP/1.1Accept: text/n3 • “GetGraph returns the serialized RDFGraph identified by OperationTarget or all of the separately serialized RDFGraphs identifed by OperationTargetSet” Protocol Spec • Accept: text/trig • Avoids redundant transmission of namespace declarations • Accept: application/trix • Allows the transformation of query results using XSLT
SPARQL Protocol getGraph() and Wildcards • Our experience: Repositories quickly fill with hundreds of graphs. • “The query environment may provide the RDF dataset to be queried.” SPARQL Query Language Spec • Wildcards might also be useful in SPARQL Protocol. • GET /qps?graph=* HTTP/1.1
Publishing with Signatures • Semantic Web Publishing Vocabulary (SWP-2) • swp:SignatureMethod specifies • a graph canonicalization method • a signature method provided by XML Signature
Publishing with Signatures - Example :G1 { :Monica ex:name "Monica Murphy“ . :Chris ex:name "Chris Bizer" . :G1 swp:assertedBy :G1 . :G1 swp:authority _:s . :G1 swp:signatureMethod swp:JjcRdfC14N-rsa-sha1 . :G1 swp:signature "..."ˆˆxsd:base64Binary . _:s foaf:mbox <mailto:patrick.stickler@nokia.com> . _:s swp:certificate "..."ˆˆxsd:base64Binary }
Publishing with Signatures - Example :G1 {:Jeremy ex:name "Jeremy Carrol" } :G2 {:Chris ex:name "Chris Bizer" } :G3 {:G1 swp:assertedBy :G3 . :G1 swp:digestMethod swp:JjcRdfC14N-sha1 . :G1 swp:digest "..."ˆˆxsd:base64Binary . :G2 swp:assertedBy :G3 . :G2 swp:digestMethod swp:JjcRdfC14N-sha1 . :G2 swp:digest "..."ˆˆxsd:base64Binary . :G3 swp:assertedBy :G3 . :G3 swp:signatureMethod swp:JjcRdfC14N-rsa-sha1. :G3 swp:signature "..."ˆˆxsd:base64Binary . :G3 swp:authority _:s . _:s foaf:mbox <mailto:patrick.stickler@nokia.com> _:s swp:certificate "..."ˆˆxsd:base64Binary }
NG4J Use Cases • Gnowsis Semantic Desktop • Leo Sauermann, DFKI, Germany • Provenance tracking in a data integration framework • Source Code Versioning • Rowland Watkins, University of Southampton, UK • Relation and provenance tracking of source code changes • SWED Semantic Web Environmental Directory • SWAD-Europe, HP Labs and ILRT • Provenance tracking in a data integration framework • Ontology Evolution in Live Science • Chris Catton, University of Oxford, UK • Tracking of concept evolution and paradigm shifts • TriQL.P Trust Architecture • Chris Bizer, Freie Universität Berlin, Germany • Filtering information using different trust policies
So, what’s the holy grail? • Reification ? • Quads ? • Named Graphs ? • RDF Dataset ?
Thanks :-) • Named Graph Website • Links to TriX, TriG, TriQL, RDFQ Specs • http://www.w3.org/2004/03/trix/ • Named Graphs, Provenance and Trust • Carroll, Bizer, Hayes and Stickler • http://www.hpl.hp.com/techreports/2004/HPL-2004-57.html • NG4J - Named Graphs API for Jena • http://www.wiwiss.fu-berlin.de/suhl/bizer/ng4j/