SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
Terp: Syntax for
OWL-friendly SPARQL queries
  Evren Sirin, Blazej Bulka and Michael Smith
              Clark & Parsia, LLC
Who are we?
• Clark & Parsia is a semantic software startup
  o   HQ in Washington, DC & office in Boston
• Provides software development and integration
  services
• Specializing in Semantic Web, web services, and
  advanced AI technologies for federal and
  enterprise customers

        http://clarkparsia.com/
        Twitter: @candp
Motivation
• Make it easy to read and write queries for
  OWL ontologies

• Allow both schema and instance queries
• Without inventing a completely new query
  language

• Not hard to learn
Querying OWL
• The most commonly used Semantic Web
  query language is SPARQL
• SPARQL intended for RDF
• Semantics based on pattern matching over
  RDF graphs
• Semantics extensions possible via entailment
  regimes
  •   SPARQL-DL extension [OWLED 2008 paper]
  •   SPARQL 1.1 entailment regime [SPARQL WG]
Simple SPARQL Query
• Query: Find the flavors of red French wines
  PREFIX rdf: <http://...>
  PREFIX wine: <http://...>

  SELECT ?wine ?flavor {
     ?wine rdf:type wine:FrenchWine .
     ?wine rdf:type wine:RedWine .
     ?wine wine:hasFlavor ?flavor .
  }
SPARQL Abbreviations
• Query: Find the flavors of red French wines
 PREFIX wine: <http://...>

 SELECT ?wine ?flavor {
    ?wine a wine:FrenchWine , wine:RedWine ;
          wine:hasFlavor ?flavor .
 }
SPARQL Abbreviations
• Query: Find the flavors of red French wines
 PREFIX wine: <http://...>

 SELECT ?wine ?flavor {
     ?wine a wine:FrenchWine , wine:RedWine ;
            wine:hasFlavor ?flavor .
 }
     Turtle keyword a
    instead of rdf:type
SPARQL Abbreviations
• Query: Find the flavors of red French wines
 PREFIX wine: <http://...>       Object lists
                             separated by comma
 SELECT ?wine ?flavor {
     ?wine a wine:FrenchWine , wine:RedWine ;
            wine:hasFlavor ?flavor .
 }
     Turtle keyword a
    instead of rdf:type
SPARQL Abbreviations
• Query: Find the flavors of red French wines
 PREFIX wine: <http://...>       Object lists
                             separated by comma
 SELECT ?wine ?flavor {
     ?wine a wine:FrenchWine , wine:RedWine ;
            wine:hasFlavor ?flavor .
 }
     Turtle keyword a                 Predicate-object
    instead of rdf:type              lists separated by
                                         semi-colon
SPARQL Abbreviations
• Query: Find the flavors of red French wines
 PREFIX wine: <http://...>       Object lists
                             separated by comma
 SELECT ?wine ?flavor {
     ?wine a wine:FrenchWine , wine:RedWine ;
            wine:hasFlavor ?flavor .
 }
     Turtle keyword a                 Predicate-object
    instead of rdf:type              lists separated by
                                         semi-colon
• Result: a concise query
OWL over RDF
• RDF knows about triples (and only triples)
• OWL has many different constructs
  •   Class/property/data expressions, axioms, etc.

• Triple-based representation of OWL can be
  •   verbose
  •   unintuitive
  •   hard to read or understand
SPARQL over OWL
• Query: Find wines that are made of at least
  two grapes
  SELECT ?wine ?flavor {
     ?wine a [ owl:intersectionOf (
                 wine:Wine
                 [ a owl:Restriction ;
                   owl:onProperty wine:madeFromGrape ;
                   owl:minCardinality 2 ])]
  }
SPARQL over OWL
• Query: Find wines that are made of at least
  two grapes
  SELECT ?wine ?flavor {
     ?wine a [ owl:intersectionOf (         RDF List
                 wine:Wine                abbreviation
                 [ a owl:Restriction ;
                   owl:onProperty wine:madeFromGrape ;
                   owl:minCardinality 2 ])]
  }
SPARQL over OWL
• Query: Find wines that are made of at least
  two grapes
  SELECT ?wine ?flavor {
      ?wine a [ owl:intersectionOf (         RDF List
                  wine:Wine                abbreviation
    Bnode         [ a owl:Restriction ;
 abbreviation       owl:onProperty wine:madeFromGrape ;
                    owl:minCardinality 2 ])]
  }
SPARQL over OWL
• Query: Find wines that are made of at least
  two grapes
  SELECT ?wine ?flavor {
      ?wine a [ owl:intersectionOf (         RDF List
                  wine:Wine                abbreviation
    Bnode         [ a owl:Restriction ;
 abbreviation       owl:onProperty wine:madeFromGrape ;
                    owl:minCardinality 2 ])]
  }


 • Result: less than ideal (no OWL shortcuts)
We have a syntax for that!
• Pick the OWL syntax suitable for you
We have a syntax for that!
• Pick the OWL syntax suitable for you
 •   I want a formal syntax: Use Functional Syntax
We have a syntax for that!
• Pick the OWL syntax suitable for you
 •   I want a formal syntax: Use Functional Syntax

 •   I want a syntax that plays nicely with XQuery
     and XML schema: Use OWL/XML syntax
We have a syntax for that!
• Pick the OWL syntax suitable for you
 •   I want a formal syntax: Use Functional Syntax

 •   I want a syntax that plays nicely with XQuery
     and XML schema: Use OWL/XML syntax

 •   I want to write OWL expressions easily: Use
     Manchester Syntax
We have a syntax for that!
• Pick the OWL syntax suitable for you
 •   I want a formal syntax: Use Functional Syntax

 •   I want a syntax that plays nicely with XQuery
     and XML schema: Use OWL/XML syntax

 •   I want to write OWL expressions easily: Use
     Manchester Syntax

 •   I want a triple-friendly syntax: Use Turtle syntax
We have a syntax for that!
• Pick the OWL syntax suitable for you
 •   I want a formal syntax: Use Functional Syntax

 •   I want a syntax that plays nicely with XQuery
     and XML schema: Use OWL/XML syntax

 •   I want to write OWL expressions easily: Use
     Manchester Syntax

 •   I want a triple-friendly syntax: Use Turtle syntax

 •   I don’t need your help: Use RDF/XML syntax
Terp Syntax
• Combine Turtle with Manchester syntax
• Use Manchester syntax for expressing class,
   property, or datatype expressions

• Manchester syntax expressions can appear
   in subject or object position of triples
SELECT ?wine ?flavor {
   ?wine a ( wine:Wine and wine:madeFromGrape min 2 )
}
Complex Terp Example
•   Query: Find meal courses that go with full-bodied
    wines, if exists return the associated label; order
    results by labels but don’t include owl:Nothing.
    SELECT ?wine ?flavor {
       ?mealCourse rdfs:subClassOf
          food:MealCourse ,
          food:hasDrink some ( wine:Wine and
                               wine:hasBody value wine:Full )
       OPTIONAL {
          ?mealCourse rdfs:label ?label
       }
       FILTER ( ?mealCourse != owl:Nothing )
    }
    ORDER BY rdfs:label
Terp Grammar
• Merge SPARQL grammar with Manchester
  syntax grammar
• Keep all the syntax features of SPARQL
• A few cases where ambiguity arises
 •   Ex: Parentheses are used for lists in SPARQL and
     for nesting in Manchester syntax
 •   Try to resolve ambiguity by the context
 •   Assume SPARQL intent otherwise
Implementation
• Terp parser implemented in Pellet and
  available as of version 2.1

• Integrated through Jena ARQ architecture
• Can translate any Terp query to regular
  SPARQL syntax

• Can be used programmatically or through
  CLI
Possible Extensions
• Allow Manchester syntax in predicate position
  •   Ex: Use equivalentTo instead of owl:equivalentClass
      and owl:equivalentProperty

• Support for additional OWL 2 constructs
 • Ex: Negative property assertions, axiom annotations
• More syntactic sugar for frequently used OWL
  features
Questions?

Mais conteúdo relacionado

Destaque

Destaque (6)

RR2010 Keynote
RR2010 KeynoteRR2010 Keynote
RR2010 Keynote
 
Empire: JPA for RDF & SPARQL
Empire: JPA for RDF & SPARQLEmpire: JPA for RDF & SPARQL
Empire: JPA for RDF & SPARQL
 
PelletServer: REST and Semantic Technologies
PelletServer: REST and Semantic TechnologiesPelletServer: REST and Semantic Technologies
PelletServer: REST and Semantic Technologies
 
Sem tech 2010_integrity_constraints
Sem tech 2010_integrity_constraintsSem tech 2010_integrity_constraints
Sem tech 2010_integrity_constraints
 
Stardog talk-dc-march-17
Stardog talk-dc-march-17Stardog talk-dc-march-17
Stardog talk-dc-march-17
 
Stardog Linked Data Catalog
Stardog Linked Data CatalogStardog Linked Data Catalog
Stardog Linked Data Catalog
 

Semelhante a Terp: An OWL-friendly SPARQL

SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeAdriel Café
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic webMarakana Inc.
 
A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebShamod Lacoul
 
Intro to OWL & Ontology
Intro to OWL & OntologyIntro to OWL & Ontology
Intro to OWL & OntologyNarni Rajesh
 
Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019Gerard Klijs
 
Alfresco in few points - Search Tutorial
Alfresco in few points - Search TutorialAlfresco in few points - Search Tutorial
Alfresco in few points - Search TutorialPASCAL Jean Marie
 
Eclipse RDF4J - Working with RDF in Java
Eclipse RDF4J - Working with RDF in JavaEclipse RDF4J - Working with RDF in Java
Eclipse RDF4J - Working with RDF in JavaJeen Broekstra
 
Web ontology language (owl)
Web ontology language (owl)Web ontology language (owl)
Web ontology language (owl)Ameer Sameer
 
Opal chapter 4_a_new_hope
Opal chapter 4_a_new_hopeOpal chapter 4_a_new_hope
Opal chapter 4_a_new_hopeForrest Chang
 
Practical Cross-Dataset Queries with SPARQL (Introduction)
Practical Cross-Dataset Queries with SPARQL (Introduction)Practical Cross-Dataset Queries with SPARQL (Introduction)
Practical Cross-Dataset Queries with SPARQL (Introduction)Richard Cyganiak
 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty FrameworkAapo Talvensaari
 
EKAW - Triple Pattern Fragments
EKAW - Triple Pattern FragmentsEKAW - Triple Pattern Fragments
EKAW - Triple Pattern FragmentsRuben Taelman
 
Yang in ODL by Jan Medved
Yang in ODL by Jan MedvedYang in ODL by Jan Medved
Yang in ODL by Jan MedvedOpenDaylight
 
Yang in OpenDaylight
Yang in OpenDaylightYang in OpenDaylight
Yang in OpenDaylightGunjan Patel
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to ScalaJohan Andrén
 
Semantic web for ontology chapter4 bynk
Semantic web for ontology chapter4 bynkSemantic web for ontology chapter4 bynk
Semantic web for ontology chapter4 bynkNamgee Lee
 
Wojciech Ogrodowczyk | 3Scale | I am a Developer
Wojciech Ogrodowczyk | 3Scale | I am a DeveloperWojciech Ogrodowczyk | 3Scale | I am a Developer
Wojciech Ogrodowczyk | 3Scale | I am a DeveloperSmash Tech
 

Semelhante a Terp: An OWL-friendly SPARQL (18)

SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic web
 
A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic Web
 
SPIN in Five Slides
SPIN in Five SlidesSPIN in Five Slides
SPIN in Five Slides
 
Intro to OWL & Ontology
Intro to OWL & OntologyIntro to OWL & Ontology
Intro to OWL & Ontology
 
Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019
 
Alfresco in few points - Search Tutorial
Alfresco in few points - Search TutorialAlfresco in few points - Search Tutorial
Alfresco in few points - Search Tutorial
 
Eclipse RDF4J - Working with RDF in Java
Eclipse RDF4J - Working with RDF in JavaEclipse RDF4J - Working with RDF in Java
Eclipse RDF4J - Working with RDF in Java
 
Web ontology language (owl)
Web ontology language (owl)Web ontology language (owl)
Web ontology language (owl)
 
Opal chapter 4_a_new_hope
Opal chapter 4_a_new_hopeOpal chapter 4_a_new_hope
Opal chapter 4_a_new_hope
 
Practical Cross-Dataset Queries with SPARQL (Introduction)
Practical Cross-Dataset Queries with SPARQL (Introduction)Practical Cross-Dataset Queries with SPARQL (Introduction)
Practical Cross-Dataset Queries with SPARQL (Introduction)
 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty Framework
 
EKAW - Triple Pattern Fragments
EKAW - Triple Pattern FragmentsEKAW - Triple Pattern Fragments
EKAW - Triple Pattern Fragments
 
Yang in ODL by Jan Medved
Yang in ODL by Jan MedvedYang in ODL by Jan Medved
Yang in ODL by Jan Medved
 
Yang in OpenDaylight
Yang in OpenDaylightYang in OpenDaylight
Yang in OpenDaylight
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Semantic web for ontology chapter4 bynk
Semantic web for ontology chapter4 bynkSemantic web for ontology chapter4 bynk
Semantic web for ontology chapter4 bynk
 
Wojciech Ogrodowczyk | 3Scale | I am a Developer
Wojciech Ogrodowczyk | 3Scale | I am a DeveloperWojciech Ogrodowczyk | 3Scale | I am a Developer
Wojciech Ogrodowczyk | 3Scale | I am a Developer
 

Último

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Último (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Terp: An OWL-friendly SPARQL

  • 1. Terp: Syntax for OWL-friendly SPARQL queries Evren Sirin, Blazej Bulka and Michael Smith Clark & Parsia, LLC
  • 2. Who are we? • Clark & Parsia is a semantic software startup o HQ in Washington, DC & office in Boston • Provides software development and integration services • Specializing in Semantic Web, web services, and advanced AI technologies for federal and enterprise customers http://clarkparsia.com/ Twitter: @candp
  • 3. Motivation • Make it easy to read and write queries for OWL ontologies • Allow both schema and instance queries • Without inventing a completely new query language • Not hard to learn
  • 4. Querying OWL • The most commonly used Semantic Web query language is SPARQL • SPARQL intended for RDF • Semantics based on pattern matching over RDF graphs • Semantics extensions possible via entailment regimes • SPARQL-DL extension [OWLED 2008 paper] • SPARQL 1.1 entailment regime [SPARQL WG]
  • 5. Simple SPARQL Query • Query: Find the flavors of red French wines PREFIX rdf: <http://...> PREFIX wine: <http://...> SELECT ?wine ?flavor { ?wine rdf:type wine:FrenchWine . ?wine rdf:type wine:RedWine . ?wine wine:hasFlavor ?flavor . }
  • 6. SPARQL Abbreviations • Query: Find the flavors of red French wines PREFIX wine: <http://...> SELECT ?wine ?flavor { ?wine a wine:FrenchWine , wine:RedWine ; wine:hasFlavor ?flavor . }
  • 7. SPARQL Abbreviations • Query: Find the flavors of red French wines PREFIX wine: <http://...> SELECT ?wine ?flavor { ?wine a wine:FrenchWine , wine:RedWine ; wine:hasFlavor ?flavor . } Turtle keyword a instead of rdf:type
  • 8. SPARQL Abbreviations • Query: Find the flavors of red French wines PREFIX wine: <http://...> Object lists separated by comma SELECT ?wine ?flavor { ?wine a wine:FrenchWine , wine:RedWine ; wine:hasFlavor ?flavor . } Turtle keyword a instead of rdf:type
  • 9. SPARQL Abbreviations • Query: Find the flavors of red French wines PREFIX wine: <http://...> Object lists separated by comma SELECT ?wine ?flavor { ?wine a wine:FrenchWine , wine:RedWine ; wine:hasFlavor ?flavor . } Turtle keyword a Predicate-object instead of rdf:type lists separated by semi-colon
  • 10. SPARQL Abbreviations • Query: Find the flavors of red French wines PREFIX wine: <http://...> Object lists separated by comma SELECT ?wine ?flavor { ?wine a wine:FrenchWine , wine:RedWine ; wine:hasFlavor ?flavor . } Turtle keyword a Predicate-object instead of rdf:type lists separated by semi-colon • Result: a concise query
  • 11. OWL over RDF • RDF knows about triples (and only triples) • OWL has many different constructs • Class/property/data expressions, axioms, etc. • Triple-based representation of OWL can be • verbose • unintuitive • hard to read or understand
  • 12. SPARQL over OWL • Query: Find wines that are made of at least two grapes SELECT ?wine ?flavor { ?wine a [ owl:intersectionOf ( wine:Wine [ a owl:Restriction ; owl:onProperty wine:madeFromGrape ; owl:minCardinality 2 ])] }
  • 13. SPARQL over OWL • Query: Find wines that are made of at least two grapes SELECT ?wine ?flavor { ?wine a [ owl:intersectionOf ( RDF List wine:Wine abbreviation [ a owl:Restriction ; owl:onProperty wine:madeFromGrape ; owl:minCardinality 2 ])] }
  • 14. SPARQL over OWL • Query: Find wines that are made of at least two grapes SELECT ?wine ?flavor { ?wine a [ owl:intersectionOf ( RDF List wine:Wine abbreviation Bnode [ a owl:Restriction ; abbreviation owl:onProperty wine:madeFromGrape ; owl:minCardinality 2 ])] }
  • 15. SPARQL over OWL • Query: Find wines that are made of at least two grapes SELECT ?wine ?flavor { ?wine a [ owl:intersectionOf ( RDF List wine:Wine abbreviation Bnode [ a owl:Restriction ; abbreviation owl:onProperty wine:madeFromGrape ; owl:minCardinality 2 ])] } • Result: less than ideal (no OWL shortcuts)
  • 16. We have a syntax for that! • Pick the OWL syntax suitable for you
  • 17. We have a syntax for that! • Pick the OWL syntax suitable for you • I want a formal syntax: Use Functional Syntax
  • 18. We have a syntax for that! • Pick the OWL syntax suitable for you • I want a formal syntax: Use Functional Syntax • I want a syntax that plays nicely with XQuery and XML schema: Use OWL/XML syntax
  • 19. We have a syntax for that! • Pick the OWL syntax suitable for you • I want a formal syntax: Use Functional Syntax • I want a syntax that plays nicely with XQuery and XML schema: Use OWL/XML syntax • I want to write OWL expressions easily: Use Manchester Syntax
  • 20. We have a syntax for that! • Pick the OWL syntax suitable for you • I want a formal syntax: Use Functional Syntax • I want a syntax that plays nicely with XQuery and XML schema: Use OWL/XML syntax • I want to write OWL expressions easily: Use Manchester Syntax • I want a triple-friendly syntax: Use Turtle syntax
  • 21. We have a syntax for that! • Pick the OWL syntax suitable for you • I want a formal syntax: Use Functional Syntax • I want a syntax that plays nicely with XQuery and XML schema: Use OWL/XML syntax • I want to write OWL expressions easily: Use Manchester Syntax • I want a triple-friendly syntax: Use Turtle syntax • I don’t need your help: Use RDF/XML syntax
  • 22. Terp Syntax • Combine Turtle with Manchester syntax • Use Manchester syntax for expressing class, property, or datatype expressions • Manchester syntax expressions can appear in subject or object position of triples SELECT ?wine ?flavor { ?wine a ( wine:Wine and wine:madeFromGrape min 2 ) }
  • 23. Complex Terp Example • Query: Find meal courses that go with full-bodied wines, if exists return the associated label; order results by labels but don’t include owl:Nothing. SELECT ?wine ?flavor { ?mealCourse rdfs:subClassOf food:MealCourse , food:hasDrink some ( wine:Wine and wine:hasBody value wine:Full ) OPTIONAL { ?mealCourse rdfs:label ?label } FILTER ( ?mealCourse != owl:Nothing ) } ORDER BY rdfs:label
  • 24. Terp Grammar • Merge SPARQL grammar with Manchester syntax grammar • Keep all the syntax features of SPARQL • A few cases where ambiguity arises • Ex: Parentheses are used for lists in SPARQL and for nesting in Manchester syntax • Try to resolve ambiguity by the context • Assume SPARQL intent otherwise
  • 25. Implementation • Terp parser implemented in Pellet and available as of version 2.1 • Integrated through Jena ARQ architecture • Can translate any Terp query to regular SPARQL syntax • Can be used programmatically or through CLI
  • 26. Possible Extensions • Allow Manchester syntax in predicate position • Ex: Use equivalentTo instead of owl:equivalentClass and owl:equivalentProperty • Support for additional OWL 2 constructs • Ex: Negative property assertions, axiom annotations • More syntactic sugar for frequently used OWL features