Change: Complex Query Pattern

created on Feb. 23, 2013, 9:25 a.m. by Hevok & updated on Feb. 25, 2013, 8:39 p.m. by Hevok

One can not only form one Graph Pattern, but one can form several Graph Patterns that might be combined. Graph Patterns can be combined into Complex Queries. These Queries are characterized by Triples, in the sense of Graph Patterns Triples might consists of Resources, Literals and Variables. Each Triple of course is closed by a Period, so it is the same System as in RDF. In general the Language that is behind this is the Turtle Language.

For example you can have a Country and the Population of this Country as Properties. So there are two Graph Patterns and in the first it asks for a Country and the Capital of this Country and these two expressions are combined by logical add and the same Country is ask for the Population of this Country. So the Graph is Transversed and all Triples that confirm to the first and second Triple will be returned. Thus one will find in the end Countries their Capitals and their Population.

Given a foaf URI for Person for that Person one wants have back the name (e.g. surname) and secondly one wants for this Person all Friends that this Person knows and for this Friends one want to have the Names. Therefore one can combine all these Graph Patterns to a more complex Graph Pattern and than ask the entire RDF Graph for Triples that conform to these conditions.

  • Graph Pattern can be combined to form Complex (Conjunctives) Queries for RDF Graph Traversal.
  • Find countries, their capitals and their population:
    • **?country** geo:capital **?capital** .
    • **?country** geo:population **?population** .
  • Given a FOAF URI, find the name of a person and the friends: http://denigma.de/profiles/profiles/hevok foaf:name ?surname '>http://denigma.de/profiles/profiles/hevok">http://denigma.de/profiles/profiles/hevok foaf:name ?surname ] foaf:knowns ?friend . ?friend foaf:name ?friend_surname .
comples-query -pattern.jpg

Categories: Tutorial
Parent: Graph Pattern

Comment: Corrected codeblock.

See entry | Admin

Comment on This Data Unit