400 likes | 804 Views
Querying the Semantic Web with RQL * G. Karvounarakis, A. Magganaraki S. Alexaki , V. Christophides , D. Plexousakis, M. Scholl , K. Tolle , The International Journal of Computer and Telecommunications Networking , Volume 42, 617 - 640 , 2003 DBLab 고명석 Contents Introduction
E N D
Querying the Semantic Web with RQL* G. Karvounarakis, A. Magganaraki S. Alexaki , V. Christophides , D. Plexousakis, M. Scholl , K. Tolle , The International Journal of Computer and Telecommunications Networking , Volume 42, 617 - 640 , 2003 DBLab 고명석
Contents • Introduction • Motivating Example • A Formal Model for RDF • The RDF Query Language : RQL • Conclusion
Introduction • Next evolution step of the web • Vast amount of information • Various kinds of descriptive information • Better knowledge • The meaning, usage, accessibility or quality of web resource • RDF enable the creation and exchange of resource metadata
Introduction • RDF Provides • Standard Representation Language • For metadata based on directed labeled graph • Schema Definition Language • For creating vocabularies of labels for these graph node • XML syntax for expressing metadata and schemas • Humanly readable and machine understandable
String fname exhibited creates Artifact Museum Artist String String lname String material sculpts title Sculptor mime-type Sculpture String String file-size paints technique Ext. Resource String Painter Painting String last_modified title fname “Reina Sofia Museum” exhibited “Pablo” &r3 &r1 paints last_modified lname &r2 “Picaso” 2000-06-09 “oil on Canvas” technique fname typeOf (instance) technique “Van” paints “oil on Canvas” &r4 subclassOf (isA) &r5 lname subPropertyof “Gogh” exhibited &r8 title fname “Rodin” creates exhibited “Rodin Museum” &r6 &r7 last_modified “August” lname mime-type “image/jpeg” 2000-02-01 Motivating Example
The RDF Query Language : RQL • RQL Provides • Select-form-where filter • Standard Boolean matching • =, <, >, like • Ex) “Painter” < “Artist” • { } • To introduce appropriate schema or data variables • “^” • Only the node labeled with the class name
Example • Q1 : Which classes can appear as domain and range of the property creates? Select $C1, $C2 from {$C1} creates {$C2} “C1 <= domain(creates) and C2 <= range(creates)” Subclassof(domain(creates)) and Subclassof(range(creates)) • Class variable are prefixed by $
Example • Q2 : Find all properties(and their range) that are applicable on class Painter Select @P, range(@P) from {$C}@P Where $C = Painter domain(P) >= Painter • @P is property variable • {x;C} • Filters data node x which are labeled with a class name • {;C} • Simply denotes a filtering condition of schema nodes
Example • Q3: Fine all information related to class Painter(i.e., its superclasses as well as direct or inherited properties) Seq(Painter, superclassof^(Painter), (select @P, domain(@P), range(@P) from {;Painter}@P))
Example • Q4: What properties can be reached(in one step) from the range classes of creates? • “ . ” • Notation implies a join condition between the range classes of the property creates and the domain of @P valuations Select $Y, @P, range(@P) from creates{$Y}.@P $Y <= domain(@P) and $Y <= range(creates)
Example • Q5: Fine the Museum resources that have been modified after year 2000 Select X, Y Form Museum{X}.last_modified{Y} Where Y >= 2000-01-01 • Return to site www.museum.es(&r4) • Return to site www.rodin.fr(&r7)
Example • Q6:Find the names of Artists whose Artifacts are exhibited in museums, along with the related Museum title
Example Select V, R, Y, Z From {X}creates.exhibited{Y}.title{Z}, {X}fname{V}, {X}lname{R}
Example • Q7: Fine the source and target value of properties emanating from ExtResources Select X, Y from {X; ExtResource}@P{Y}
Example • Q8: Find the descriptions of resources whose URI matches “www.museum.es” Select X, (select $W, (select @P, Y from {X;$W}@P{Y}) from $W{X}) From Resource{X} Where X like “www.museum.es”
Example • Q9: Find the description, under the form of triples, of resources excluding properties related to the class ExtResource ((Select X, @P, Y from {X}@P{Y}) Union (Select X, type, $W from $W{X})) minus ((Select X, @P, Y from {X;ExtResource}@P{Y}) union (Select X, type, ExtResorse from ExtResorse{X}))
SquishQL • Use SQL-like constructs to reflectRDF‘ graph syntax • Variables are indicated by ‘?’ • Most general pattern is (?x, ?y, ?z) • There are two classes of constraints • Patterns • <subject, predicate, object> describing edges of the graph and conjunction operator • Filter expressions • Remove the possibility
SquishQL • Query typically built on five clauses • SELECT Clause • Identifies the variables to be returned to the application • FROM Clause • specifies the model by URI • WHERE Clause • Specifies the graph pattern as the conjunction of the list of triple patterns
SquishQL • Query typically built on five clauses • AND Clause • Specifies the Boolean expressions over values of URIs and literals • arithmetic comparisons, and boolean expressions, including disjunction and negation • USING Clause • A way to shorten the length of URIs
SquishQL - Example Query: Finds the titles of documents in http://example.com/xmleurope/presentations.rdf SELECT ?title FROM http://example.com/xmleurope/presentations.rdf WHERE (?doc, <dc:title>, ?title), (?doc, <rdf:type>, <foaf:Document>) USING dc FOR <http://purl.org/dc/elements/1.1/>, rdf FOR <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
RDFPath • Plan to make an XPath*-like query system for the RDF data model
RDFPath • Node Queries • / • Returns all nodes. • [ ] • Returns all anonymous nodes • [foaf:mbox "me@aaronsw.com"] • Returns all nodes where the value of the property foaf:mbox equals the literal me@aaronsw.com • [foaf:mbox "me@aaronsw.com" ; foaf:homepage <http://www.aaronsw.com>] • Returns nodes where foaf:mbox equals the literal of my email address and foaf:homepage equals the resource of my homepage
RDFPath • Node Queries • [a rdf:Bag] • Returns nodes of type rdf:Bag • <http://example.org/#foo> • Returns the resource <http://example.org/#foo> • "Whatever" • Returns the literal "Whatever"
RDFPath • Sub-queries • /dc:creator • Returns values of the dc:creator property for all resources • /[a rdfs:ContainerMembershipProperty] • Returns the values of all container membership properties (_1, _2, etc.) for all resources • "Aaron Swartz"\dc:creator • Returns all resources with a dc:creator property of "Aaron Swartz"
RDFPath • Query Refinements • /dc:creator [a w3c:StaffMember] • Returns all of the w3c:StaffMembers who are listed as the dc:creator of a resource
TRIPLE • Goal • use various semantics in one inference • Information integration • Syntactically inspired by F-Logic: • subject[predicateobject] • Example • Sara [livesIn → Linköping; hasAge → 35] • Sara [hasChild → Lotta[hasAge → 5]] • Sara[believes →<Lotta[hasIllness → cold]>]
model1 Set of RulesDescribing Semantics of a Data Model model2 TRIPLE
TRIPLE – language description • Namespace and resource abbreviations: • rdf := “http://www.w3.org/1999/02/22-rdf-syntax-ns#” • isa := rdf:subClassOf • Statements, triples, molecules: • subject[predicateobject] • subject[p1o1;p2 o2; ...] • s1[p1 s2[p2o] ] • Models, model expressions, parameterized models: • s[po]@m “triple <s,p,o> in model m” • s[po]@(m1 m2) model intersection, union, diff. • s[po]@sf(m1, X, Y) Skolem function
TRIPLE Michael Sintek dc:title dc:creator dfki:d_01_01 dc:subject dc:subject ... RDF triples Query: FORALL D <- D[dc:subject RDF]@dfki:documents TRIPLE - Example namespace abbreviations dc := “http://purl.org/dc/elements/1.0/”. dfki := “http://www.dfki.de/”. block @dfki:documents { } dfki:d_01_01 [ dc:title “TRIPLE”; dc:creator “Michael Sintek”; dc:subject RDF; dc:subject triples; ... ]. fact
TRIPLE - Example Cars Ontology with RDF Schema Semantics @cars { xyz:MotorVehicle[rdfs:subClassOf -> rdfs:Resource]. xyz:PassengerVehicle[rdfs:subClassOf -> xyz:MotorVehicle]. xyz:Truck[rdfs:subClassOf -> xyz:MotorVehicle]. xyz:Van[rdfs:subClassOf -> xyz:MotorVehicle]. xyz:MiniVan[ rdfs:subClassOf -> xyz:Van; rdfs:subClassOf -> xyz:PassengerVehicle]. } xyz:MotorVehicle xyz:Truck xyz:Van xyz:PassengerVehicle xyz:MiniVan X = xyz:Van X = xyz:Truck X = xyz:PassengerVehicle FORALL X <- X[rdfs:subClassOf -> xyz:MotorVehicle]@cars. X = xyz:Van X = xyz:Truck X = xyz:PassengerVehicle X = xyz:MiniVan FORALL X <- X[rdfs:subClassOf -> xyz:MotorVehicle]@rdfschema(cars).
VERSA • Graphic-based query language for querying RDF Model • the traversal expression which matches patterns in the model's graph all() - dc:date -> * all() |- rdfs:label -> eq("Web [ 1 ]") <List> <String>2001-03-04</String> <String>2001-04-20</String> </List>
RDFQL • RDFQL is the language used by RDF Gateway applications and agents • RDF Gateway • A platform for Semantic Web applications and agents • A simple SQL-style language • with inference extensions to perform complex deductive queries
RDFQL SELECT ?bFROM <http://weblog.burningbird.net/resume.rdf>WHERE (?a, <bbd:title>, ?b)USING bbd for >http://www.burningbird.net/resume_schema#>