Making Topicmaps SPARQL


Published on

This presentation describes a proposal for using SPARQL as a query language for topic maps repositories.

Published in: Technology, Business
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Oxford-based software technology company developing products focussed on helping organisations to better manage the complex relationships between conceptual models such as business processes and domain knowledge and documents, data and other information that people use on a day-to-day basis.

    Developed out of working on the ISO standard for structured information exchange – Topic Maps.
  • For the (typical) binary association case, or for associations that have only two distinct role types, this produces an intuitive result.
  • Making Topicmaps SPARQL

    1. 1. Making Topic Maps Sparql
    2. 2. Agenda • Rationale • SPARQL • Theory • Some examples
    3. 3. TMSparql • A set of conventions and a small pseudo- ontology to enable a topic map to present itself as a SPARQL end-point
    4. 4. Rationale • Integration • A Simple Query Language
    5. 5. SPARQL • A query language based on graph pattern matching with support for value testing. • The result of a SPARQL query is a list of the different combination of variable-to- term mappings that match against the queried graph
    6. 6. Basic Matching PREFIX foaf: <> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . ?x foaf:mbox ?mbox }
    7. 7. Filtering PREFIX dc: <> PREFIX ns: <> SELECT ?title ?price WHERE { ?x ns:price ?price . FILTER (?price < 30.5) ?x dc:title ?title . }
    8. 8. Optional Pattern Matching PREFIX foaf: <> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?mbox } }
    9. 9. Alternative Patterns PREFIX dc10: <> PREFIX dc11: <> SELECT ?title WHERE { { ?book dc10:title ?title } UNION { ?book dc11:title ?title } }
    10. 10. Goals • Don’t get caught up in RDF <-> Topic Maps conversion • Make the result as intuitive and interoperable as possible – No extensions to the SPARQL syntax – Limited use of “magic” identifiers • Linked Data Query Interop – Make it possible to fire the same queries at RDF- based and Topic Maps-based SPARQL endpoints and get equivalent results.
    11. 11. Resource Identifiers • In RDF, every resource has a single URI identifier. • In Topic Maps topics in particular have multiple identifiers. • Solution: – Any subject identifier can be used to refer to a topic item. – Any item identifier can be used to refer to a topic map item
    12. 12. Basic Triple Patterns • To make TMSparql intuitive and to make SPARQL queries to Topic Maps equivalent to RDF we introduce a number of basic triple matching patterns. • The intuitive nature of TMSparql comes from being selective and restrictive about how these patterns are defined.
    13. 13. Type-Instance Triple • ?instance a ?type • ?instance rdf:type ?type – ?type identifies a topic item – ?instance identifies a topic, association, occurrence or role item that is an instance of the topic identified by ?type
    14. 14. Examples SELECT ?person { ?person a ont:person } Finds all instances of ont:person SELECT ?type { a ?type } Returns the topics that define the type(s) of the topic with the subject or item identifier
    15. 15. Topic Property Triple • ?topic ?type ?value – ?topic bound to a topic item – ?type bound to a topic item – ?value bound to the value of an occurrence or name of ?topic where the occurrence type is defined by ?type
    16. 16. Examples SELECT ?person, ?age { ?person a ont:person . ?person ont:age ?age } Finds all instances of ont:person that have an ont:age occurrence and returns the each matching person/age pair.
    17. 17. Examples • The object part of the triple binds to a literal value, so we can also make use of SPARQL FILTER SELECT ?person , ?age { ?person a ont:person . ?person ont:age ?age . FILTER ( ?age >= 18 ) } Find all people we can serve beer to
    18. 18. Related Topics Triple • ?topic ?roleType ?relatedTopic – Binds ?topic to any topic that plays a role of a type other than the type bound to ?roleType in an association – Binds ?roleType to the type of role played by the topic bound to ?relatedTopic – Binds ?relatedTopic to any topic that plays a role of the type bound to ?roleType • Allows us to traverse an association using the target role type as the predicate.
    19. 19. Example SELECT ?person, ?company { ?person ont:employer ?company } Binds ?company to any topic that plays a role of type ont:employer in an association and binds ?person to the topic(s) that play any other type of role in that association.
    20. 20. Aside: Mapping RDF Vocabularies • Map RDF predicates that have a literal range to occurrence types. • Map RDF predicates that have a resource range to role types (and generate the association type and inverse role type). E.g. If we have: – foaf:name mapped to a name type and – foaf:member mapped to a role type Then the following query works against an RDF-based or TM-based endpoint: SELECT ?memberName, ?groupName { ?g foaf:member ?m . ?m foaf:name ?memberName . ?g foaf:name ?groupName }
    21. 21. TMSparql Predicates • The basic triple patterns introduced above provide the ability to traverse from topic to topic and to retrieve and filter on the properties of topics. • For the occasions when a topic map practitioner needs to get into more detail, we introduce a number of predicates that perform different model traversals. • All TMSparql predicates use the namespace (mapped to tms: in the following examples)
    22. 22. TMSparql Predicates • tms:reifier – Traversal from a topic map item to its reifier. • tms:topicProperty – Traversal from a topic item to its name and occurrence items • tms:value – Traversal from a name or occurrence item to its value • tms:role – Traversal from an association item to its role items • tms:player – Traversal from a role item to the role player topic item • tms:scope – Traversal from a scoped topic map item to the topic items in its scope.
    23. 23. Example SELECT ?employmentAssoc, ?person, ?company, ?position { ?employmentAssoc a ont:worksFor . ?employmentAssoc tms:role ?r1 . ?r1 a ont:employee . ?r1 tms:player ?person . ?r2 a ont:employer . ?r2 tms:player ?company . } Finds all associations of type ont:worksFor with at least one role of type ont:employee and one of type ont:employer and binds the role players to ?person and ?company respectively.
    24. 24. Conclusion • TMSparql is an implementation of the SPARQL query language on top of the TMDM. • With careful mapping of ontologies, it is possible to create a TMDM repository for RDF data that responds to SPARQL queries in the same way as a “native” RDF repository would • TMSparql makes it possible for TMDM repositories to participate more fully in the Linked Data web