SlideShare a Scribd company logo
Making Topic Maps
Sparql
Agenda
• Rationale
• SPARQL
• Theory
• Some examples
TMSparql
• A set of conventions and a small pseudo-
ontology to enable a topic map to present
itself as a SPARQL end-point
Rationale
• Integration
• A Simple Query Language
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
Basic Matching
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox WHERE
{
?x foaf:name ?name .
?x foaf:mbox ?mbox
}
Filtering
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ns: <http://example.org/ns#>
SELECT ?title ?price WHERE
{
?x ns:price ?price .
FILTER (?price < 30.5)
?x dc:title ?title .
}
Optional Pattern Matching
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox WHERE
{
?x foaf:name ?name .
OPTIONAL { ?x foaf:mbox ?mbox }
}
Alternative Patterns
PREFIX dc10: <http://purl.org/dc/elements/1.0/>
PREFIX dc11: <http://purl.org/dc/elements/1.1/>
SELECT ?title WHERE
{
{ ?book dc10:title ?title } UNION { ?book
dc11:title ?title }
}
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.
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
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.
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
Examples
SELECT ?person {
?person a ont:person
}
Finds all instances of ont:person
SELECT ?type {
http://www.networkedplanet.com/ a ?type
}
Returns the topics that define the type(s) of the topic
with the subject or item identifier
http://www.networkedplanet.com.
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
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.
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
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.
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.
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
}
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
http://www.networkedplanet.com/tmsparql
(mapped to tms: in the following examples)
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.
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.
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

More Related Content

PPTX
SPARQL 1.1 Status
PDF
Entity Retrieval (tutorial organized by Radialpoint in Montreal)
PDF
Data translation with SPARQL 1.1
PDF
Datatype
PPTX
Regular expressions
PPT
Aidan's PhD Viva
PPTX
Haystack 2019 Lightning Talk - Relevance on 17 million full text documents - ...
PDF
Webinar: Simpler Semantic Search with Solr
SPARQL 1.1 Status
Entity Retrieval (tutorial organized by Radialpoint in Montreal)
Data translation with SPARQL 1.1
Datatype
Regular expressions
Aidan's PhD Viva
Haystack 2019 Lightning Talk - Relevance on 17 million full text documents - ...
Webinar: Simpler Semantic Search with Solr

What's hot (14)

PDF
From DOT to Dotty
ODP
Information Extraction from the Web - Algorithms and Tools
ODP
Graph Data -- RDF and Property Graphs
PDF
Implementing Higher-Kinded Types in Dotty
PDF
Two graph data models : RDF and Property Graphs
PDF
An Introduction to NLP4L - Natural Language Processing Tool for Apache Lucene...
PDF
Exploiting Entity Linking in Queries For Entity Retrieval
PPT
RDF briefing
PPTX
SPARQL Cheat Sheet
PPT
Twinkle: A SPARQL Query Tool
PPTX
Semantic web meetup – sparql tutorial
PPTX
SPIN in Five Slides
PDF
Presentation of OpenNLP
PDF
SPARQL Query Verbalization for Explaining Semantic Search Engine Queries
From DOT to Dotty
Information Extraction from the Web - Algorithms and Tools
Graph Data -- RDF and Property Graphs
Implementing Higher-Kinded Types in Dotty
Two graph data models : RDF and Property Graphs
An Introduction to NLP4L - Natural Language Processing Tool for Apache Lucene...
Exploiting Entity Linking in Queries For Entity Retrieval
RDF briefing
SPARQL Cheat Sheet
Twinkle: A SPARQL Query Tool
Semantic web meetup – sparql tutorial
SPIN in Five Slides
Presentation of OpenNLP
SPARQL Query Verbalization for Explaining Semantic Search Engine Queries
Ad

Similar to Making Topicmaps SPARQL (20)

PPTX
SPARQL introduction and training (130+ slides with exercices)
PDF
Nikunau
ODP
EvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge Bases
PPT
ontology.ppt
PPTX
First Steps in Semantic Data Modelling and Search & Analytics in the Cloud
PPTX
Sparql
PPTX
Semantic web for ontology chapter4 bynk
PDF
Introduction to Graphs with Neo4j
PPT
SPARQL in the Semantic Web
KEY
T3dallas typoscript
PPTX
PDF
Graph databases & data integration v2
PDF
RDF and Java
PPTX
Jena Programming
PPTX
What;s Coming In SPARQL2?
PDF
GramsciProject - technical presentation
PPT
introduction-to-rdf-schema-revised complete
PPT
Semantic web
PDF
Modules of the twenties
PPT
Re-using Media on the Web: Media fragment re-mixing and playout
SPARQL introduction and training (130+ slides with exercices)
Nikunau
EvoPat - Pattern-Based Evolution and Refactoring of RDF Knowledge Bases
ontology.ppt
First Steps in Semantic Data Modelling and Search & Analytics in the Cloud
Sparql
Semantic web for ontology chapter4 bynk
Introduction to Graphs with Neo4j
SPARQL in the Semantic Web
T3dallas typoscript
Graph databases & data integration v2
RDF and Java
Jena Programming
What;s Coming In SPARQL2?
GramsciProject - technical presentation
introduction-to-rdf-schema-revised complete
Semantic web
Modules of the twenties
Re-using Media on the Web: Media fragment re-mixing and playout
Ad

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Spectroscopy.pptx food analysis technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Electronic commerce courselecture one. Pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
cuic standard and advanced reporting.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Machine Learning_overview_presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Cloud computing and distributed systems.
Encapsulation_ Review paper, used for researhc scholars
Spectroscopy.pptx food analysis technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Electronic commerce courselecture one. Pdf
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Weekly Chronicles - August'25-Week II
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
cuic standard and advanced reporting.pdf
The AUB Centre for AI in Media Proposal.docx
sap open course for s4hana steps from ECC to s4
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Machine Learning_overview_presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Cloud computing and distributed systems.

Making Topicmaps SPARQL

  • 2. Agenda • Rationale • SPARQL • Theory • Some examples
  • 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. Rationale • Integration • A Simple Query Language
  • 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. Basic Matching PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . ?x foaf:mbox ?mbox }
  • 7. Filtering PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX ns: <http://example.org/ns#> SELECT ?title ?price WHERE { ?x ns:price ?price . FILTER (?price < 30.5) ?x dc:title ?title . }
  • 8. Optional Pattern Matching PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?mbox } }
  • 9. Alternative Patterns PREFIX dc10: <http://purl.org/dc/elements/1.0/> PREFIX dc11: <http://purl.org/dc/elements/1.1/> SELECT ?title WHERE { { ?book dc10:title ?title } UNION { ?book dc11:title ?title } }
  • 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. 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. 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. 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. Examples SELECT ?person { ?person a ont:person } Finds all instances of ont:person SELECT ?type { http://www.networkedplanet.com/ a ?type } Returns the topics that define the type(s) of the topic with the subject or item identifier http://www.networkedplanet.com.
  • 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. 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. 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. 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. 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. 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. 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 http://www.networkedplanet.com/tmsparql (mapped to tms: in the following examples)
  • 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. 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. 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

Editor's Notes

  • #2: 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.
  • #20: For the (typical) binary association case, or for associations that have only two distinct role types, this produces an intuitive result.