Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
A Comparison of RDF Query Language Peter Haase, Jeen Brokstra, Andreas Eberhart, Raphael Volz, Proceedings of the Third International Semantic Web Conference, Hiroshima, Japan, 2004 ,University of Karlsruhe DBLab 고명석 Database Laboratory 1 Contents Introduction Language Dimensions Query Language Usecases Conclusion Database Laboratory 2 Introduction Resource Description Framework Standard for data representation and exchange on the Semantic Web We present a comparison of six representative query language for RDF Database Laboratory 3 Language Dimensions The requirement on a RDF query language RDF abstract data model Independent of a concrete serialization syntax Formal semantic and Inference Formal semantic provide a dependable basis for reasoning about the meaning of an RDF graph Support for XML schema data type Represent data value in RDF Free support for making statement about resource Complete information about any resource is available in the RDF query Database Laboratory 4 Query Language RQL OQL-like syntax Use select-from-where filter Relies on a formal graph model RQL implemented ICS_FORTH’s RDF Suite Sesame system Select Pub From {Pub} ns3:year {y} Where y = “2004” Using namespace ns3=…… Database Laboratory 5 Query Language SeRQL Stand for Sesame RDF Query Language Syntax is similar to RQL Supports generalized path expression SELECT * FROM {R} <rdfs:label> {L} WHERE L like "*john*" Database Laboratory 6 Query Language TRIPLE Goal use various semantics in one inference Information integration The language is derived from F-Logic subject[predicateobject] FORALL X ( X[rdfs:label] “foo”])@default:in return all resource which have a label “foo” Database Laboratory 7 Query Language RDQL A simple SQL-style language The language used by RDF Gateway applications and agents Select ?p Where (?p, <rdfs:label>, “foo”) Collects all resource with label “foo” Database Laboratory 8 Query Language N3 Notation3 provides a text-based syntax for RDF N3 supported by Euler CWN ?y rdfs:label “foo” => ?y a:QueryResult Collects all resource with label “foo” Database Laboratory 9 Query Language Versa Basic form ListExpr – ListExpr BoolExpr Return a list of all objects of matching triples All() – rdfs:label * Return a list containing all labels All() |- rdfs:label eq(“foo”) Yield all resource having the label “foo” Database Laboratory 10 Usecases Simple Data “-” : no support, “●” : full support “○” : partial support Database Laboratory 11 Usecase Graph Path Expression Query RDQL Triple SeRQL Versa N3 RQL Path ● ● ● ● ● ● Optional Path Expression RDF provide means to deal with irregularities and incomplete information Query Optional Path Database Laboratory RDQL Triple SeRQL Versa - - ● ● N3 RQL - ○ 12 Usecase Graph What are the name and, if known, the e-mail of the authors of all available publications? SELECT PersonName, Email From {X} <ns3:author>{} <rdfs:member> {p}<ns3:name>{PersonName}; [<ns3:email> {Email}] USING NAMESPASE ns3 = <!…> <SeRQL> <RQL> Database Laboratory (select PersonName, Email from {x} s:author {y}.rdfs:member{z} s:name{PersonName}, {z}s:email{Email} ) union ( select PersonName, Email from {x} s:author {y}.rdfs:member{z} s:name{PersonName} where not, (z in select x from {x}s:email{e})) Using namespace S=…., rdfs=…. 13 Usecase Relational Basic algebraic operation Union Return the table of all topic that and(union) the titles of all publications Query RDQL Triple SeRQL Versa N3 RQL Union - ● - ● ● ● Database Laboratory 14 Usecase Relational Basic algebraic operation Difference Return the labels of all topic that are not titles of publications Query RDQL Difference - Triple SeRQL Versa - - (select title from s:Topic{T}.rdfs:label{title} ) minus ( select title from s:publication{P}, s:title{title}) using namespace S=…., rdfs=…. Database Laboratory ○ N3 RQL - ● <RQL> 15 Usecase Relational Basic algebraic operation Quantification Return the person who are authors of all publications Query RDQL Quantification - Triple SeRQL Versa - - - N3 RQL - ● SELECT A FROM Artist{A} WHERE forall Z in (select W from {A}creates{W}) SUCH THAT exists D in (select X from {X}exhibited{Y}) SUCH THAT D = Z <RQL> Database Laboratory 16 Usecase Aggregation and Grouping Aggregation Count the number of author of a publication <N3> Query RDQL Counting - Triple SeRQL Versa - - ● N3 RQL ● ● {?y.sam:author math:memberCount ?result .} => {:Query : Result ?result}. Grouping None of the compared query language allows to group values SQL GROUP BY Database Laboratory 17 Usecase Recursion Underlying relationship is transitive nature Return all subject of topic “information System”, recursively Query RDQL Recusion - Triple SeRQL Versa ● - ● N3 RQL ● - FROALL O, P, V O[acm:SubTopic V] EXISTS W (O[acm:SubTopic W] AND W[acm:SubTopic V] @default:In. FORALL Y (‘…#ACMTopic/’ : Information_System[acm:SubTopic Y]@default:In. <Triple> Database Laboratory 18 Usecase Reification Adds a meta-layer to the graph and allow treating RDF statements Query RDQL Reification ○ Triple SeRQL Versa ○ ● N3 RQL - ○ ○ <Triple> FORALL V, W, X, Y, Z (V[W <X[Y Z]>) (all() |- rdf:subject <Versa> @”../versa-sample.rdf#Paper”) – dc:create * Database Laboratory 19 Usecase Collection and Containers Retrieve the individual and all elements Return the first author of Publication X Query RDQL Sequence ○ Database Laboratory Triple SeRQL Versa ○ ○ ○ N3 RQL ○ ○ 20 Usecase Namespaces Integral part of any query language for webbased data Return all resources whose namespace starts with http://www.aifb.unikalsrhe.de/. Query RDQL Namespace ○ Triple SeRQL Versa N3 RQL ● ● ● - - select ?x ?y ?z where(?x ?y ?z) <RDQL> AND ?x= ~ “http://www.aifb.uni-karlsruhe.de/*” Database Laboratory 21 Usecase Language XML-style language tagging RDF literal can optionally carry an xml:lang attribute Return the German label of the topic whose English label is “Database Management” Query RDQL Language - Triple SeRQL Versa N3 RQL ● - - - - select deLabel from {} <rdfs:label> {deLabel, enLabel} where lang(deLabel) = “de” and lang(enLabel) = “en” and <SeRQL> label(enLabel) = “Database Management” Database Laboratory 22 Usecase Literal and Datatypes RDF supports the type system of XML schema data type Return all publication where the page number is the integer value “08” Query RDQL Triple SeRQL Versa N3 RQL Lexical Space - - ● - - - Return all publication where the page number is the integer value 8 Query RDQL Triple SeRQL Versa N3 RQL Value Space ○ - ● - - - Database Laboratory 23 Usecase Element RDF schema vocabulary supports the entailment if implicit information Query RDQL Triple SeRQL Versa N3 RQL Entailment - ○ ● - ○ ● select publications from ns3:Publication{publication} using namespace ns3 = <!http://www.aifb.de/wbs/pha/sample.rdf#> <RQL> Database Laboratory 24 Conclusion Query RDQL Triple SeRQL Versa N3 RQL Path • • • • • • Optional Path - - • • - ◦ Union - • - • • • Difference - - - ◦ - • Quantification - - - - - • Counting - - - • • • Recusion - • - • • - Reification ◦ ◦ • ◦ - ◦ Sequence ◦ ◦ ◦ ◦ ◦ ◦ Namespace ◦ - • - • • Language - - • - - - Lexical Space • • • • • • Value Space ◦ - • - - - Entailment - ◦ • - ◦ • Database Laboratory 25