SlideShare ist ein Scribd-Unternehmen logo
1 von 24
MS.AMBREEN
SEMANTIC WEB
TOPIC CONTINUED FROM
LECTURE#8
LECTURE#9
BASIC SPARQL QUERY
PROGRAMMING SKILLS
 A typical query includes the following structure, some parts are optional:
 Declear prefix shortcuts (optional)
 PREFIX foo: <...>
 Query result clause
 SELECT ...
 Define the dataset (optional)
 FROM <...>
 Query pattern
 WHERE {
 ...
 }
 Query modifiers (optional):
 Group BY ...
 HAVING
 ORDER BY
 LIMIT
 OFFSET
 VALUES
QUERY STRUCTURE IN SPARQL
 rdf: http://xmlns.com/foaf/0.1/
 rdfs: http://www.w3.org/2000/01/rdf-schema#
 owl: http://www.w3.org/2002/07/owl#
 xsd: http://www.w3.org/2001/XMLSchema#
 dc: http://purl.org/dc/elements/1.1/
 foaf: http://xmlns.com/foaf/0.1/
 obo: <http://purl.obolibrary.org/obo/>
COMMON PREFIXES
 Similar to its use in SQL, SELECT in SPARQL allows you to
define which variables you want values returned and output.
Like SQL you can list these individually or use an asterisk (*)
to specify values for each variable. E.g.
 SELECT ?a ?text
 SELECT *
 If you don't want duplicates you can append DISTINCT after
SELECT. e.g.,
 SELECT DISTINCT ?country
HOW TO SELECT?
 The WHERE clause defines where you want to find values for
the variables defined in the SELECT clause.
HOW TO PROGRAM INSIDE WHERE?
 The basic unit is a triple, which is made up of three components,
a subject, a predicate and an object. Each of the three
components can take one of two forms:
 put a ? prior to the variable name, e.g., ?a.
 a Universal Resource Identifier (URI).
 Note: A prefix for the namespace of the URI can be utilized.
 These triples can then be concatenated together using a full-stop
(.). Eventually, an interconnected graph of nodes joined by
relationships is built up.
 A semi-colon (;) can be used after each triple to replace the
subject for the next triple if it is the same. In this way, you only
need to define the predicate and object. e.g.,
 ?x rdf:type mebase:User ;
foaf:homepage ?homepage ;
foaf:mbox ?mbox
TRIPLE REPRESENTATIONS.
 The UNION clause:
return results to match at least one of multiple patterns
 The OPTIONAL clause is also often used.
 The FILTER clause filters the results based on certain
conditions.
CLAUSES
A solution sequence modifier is one of:
 Order modifier: put the solutions in order
 Projection modifier: choose certain variables
 Distinct modifier: ensure solutions in the sequence are unique
 Reduced modifier: permit elimination of some non-distinct
solutions
 Offset modifier: control where the solutions start from in the
overall sequence of solutions
 Limit modifier: restrict the number of solutions
HOW TO USE MODIFERS?
 This section provides many examples on how to query the RDF
triple store:
 Example #1: Find all class-containing ontology graphs:
 This example is aimed to find all ontologies in our RDF triple
store. Typically every single ontology includes at least one
class. This SPARQL script searches those ontology graphs in
the RDF triple store that contains at least one class.
SPARQL EXAMPLES TO QUERY RDF
TRIPLE STORE
 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT
distinct ?graph_uri WHERE { GRAPH ?graph_uri { ?s rdf:type
owl:Class } . }
BELOW IS THE SPARQL SCRIPT:
 Example #2: Find subclasses of an ontology term:
 This example is aimed to find all subclasses of an ontology
term.
 PREFIX obo-term: <http://purl.obolibrary.org/obo/> SELECT
DISTINCT ?x ?label FROM
<http://purl.obolibrary.org/obo/merged/OAE> WHERE { ?x
rdfs:subClassOf obo-term:OAE_0000001. ?x rdfs:label ?label. }
BELOW IS THE SPARQL SCRIPT:
 Example #3: Find the number of all class (or object,
annotation, or datatype property) terms of an ontology:
 This example is aimed to find the number of all class terms of
an ontology.
 SELECT count(?s) as ?VO_class_count FROM
<http://purl.obolibrary.org/obo/merged/VO> WHERE { ?s a
owl:Class . ?s rdfs:label ?label . FILTER regex( ?s, "VO_" ) }
BELOW IS THE SPARQL SCRIPT:
 Example #4: Retrieve definition and authors of all classes in
an ontology:
 This example is aimed to retrieve the definitions of all classes
that have definitions in an ontology.
 PREFIX obo-term: <http://purl.obolibrary.org/obo/> SELECT
?s ?label ?definition ?author FROM
<http://purl.obolibrary.org/obo/merged/VO> WHERE { ?s a
owl:Class . ?s rdfs:label ?label . ?s obo-term:IAO_0000115
?definition . ?s obo-term:IAO_0000117 ?author . }
BELOW IS THE SPARQL SCRIPT:
 Example #5: Retrieve general annotations of an ontology:
 This example is aimed to retrieve general annotation
descriptions of the ontology. The result will return different
types of annotations such as "creator", "description"s, etc.
 PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT
DISTINCT ?p, ?o FROM
<http://purl.obolibrary.org/obo/merged/OAE> WHERE{ ?s a
owl:Ontology . ?s ?p ?o .}
BELOW IS THE SPARQL SCRIPT
 Example #5: Query on axiom: Find vaccines containing egg
protein allergen:
 The above examples are mostly based on ontology annotation
properties. How to perform SPARQL queries based on logical
axioms with object properties (or relations)? Here we provide
some example.
 PREFIX has_vaccine_allergen:
<http://purl.obolibrary.org/obo/VO_0000531> PREFIX
chicken_egg_protein_allergen:
<http://purl.obolibrary.org/obo/VO_0000912> SELECT
distinct ?vaccine_label ?vaccine FROM
<http://purl.obolibrary.org/obo/merged/VO> WHERE {
?vaccine rdfs:label ?vaccine_label . ?vaccine rdfs:subClassOf
?vaccine_restriction . ?vaccine_restriction owl:onProperty
has_vaccine_allergen:; owl:someValuesFrom
chicken_egg_protein_allergen: . }
BELOW IS ONE SUCH SPARQL SCRIPT:
 Prefix obo: <http://purl.obolibrary.org/obo/> SELECT distinct
?label ?s From <http://purl.obolibrary.org/obo/merged/VO>
Where { ?s rdfs:label ?label . ?s rdfs:subClassOf ?s1 . ?s1
owl:onProperty obo:VO_0000531; owl:someValuesFrom
obo:VO_0000912 . }
NOTE THAT THE FOLLOWING CODE HAS
THE SAME EFFECT AS THE TOP CODE:
 The difference between the above two sets of SPARQL codes
is that the first one looks easier to read.

Weitere ähnliche Inhalte

Was ist angesagt?

070517 Jena
070517 Jena070517 Jena
070517 Jena
yuhana
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPedia
Katrien Verbert
 

Was ist angesagt? (19)

SPARQL Tutorial
SPARQL TutorialSPARQL Tutorial
SPARQL Tutorial
 
SPARQL in a nutshell
SPARQL in a nutshellSPARQL in a nutshell
SPARQL in a nutshell
 
RDF Validation Future work and applications
RDF Validation Future work and applicationsRDF Validation Future work and applications
RDF Validation Future work and applications
 
Jena Programming
Jena ProgrammingJena Programming
Jena Programming
 
SPARQL Cheat Sheet
SPARQL Cheat SheetSPARQL Cheat Sheet
SPARQL Cheat Sheet
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
SPARQL 1.1 Status
SPARQL 1.1 StatusSPARQL 1.1 Status
SPARQL 1.1 Status
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
 
Reflection
ReflectionReflection
Reflection
 
070517 Jena
070517 Jena070517 Jena
070517 Jena
 
ShEx by Example
ShEx by ExampleShEx by Example
ShEx by Example
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
 
Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
 
Clonedigger-Python
Clonedigger-PythonClonedigger-Python
Clonedigger-Python
 
BioSD Tutorial 2014 Editition
BioSD Tutorial 2014 EdititionBioSD Tutorial 2014 Editition
BioSD Tutorial 2014 Editition
 
Chapter 5 Class File
Chapter 5 Class FileChapter 5 Class File
Chapter 5 Class File
 
Solr Introduction
Solr IntroductionSolr Introduction
Solr Introduction
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPedia
 
Towards an RDF Validation Language based on Regular Expression Derivatives
Towards an RDF Validation Language based on Regular Expression DerivativesTowards an RDF Validation Language based on Regular Expression Derivatives
Towards an RDF Validation Language based on Regular Expression Derivatives
 

Ähnlich wie Semantic Web

Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
Emanuele Della Valle
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
Katrien Verbert
 

Ähnlich wie Semantic Web (20)

Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
 
What;s Coming In SPARQL2?
What;s Coming In SPARQL2?What;s Coming In SPARQL2?
What;s Coming In SPARQL2?
 
SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)
 
Sparql
SparqlSparql
Sparql
 
The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Querying Bio2RDF data
Querying Bio2RDF dataQuerying Bio2RDF data
Querying Bio2RDF data
 
SPARQL Query Forms
SPARQL Query FormsSPARQL Query Forms
SPARQL Query Forms
 
Aidan's PhD Viva
Aidan's PhD VivaAidan's PhD Viva
Aidan's PhD Viva
 
Data in RDF
Data in RDFData in RDF
Data in RDF
 
Re-using Media on the Web: Media fragment re-mixing and playout
Re-using Media on the Web: Media fragment re-mixing and playoutRe-using Media on the Web: Media fragment re-mixing and playout
Re-using Media on the Web: Media fragment re-mixing and playout
 
BioSamples Database Linked Data, SWAT4LS Tutorial
BioSamples Database Linked Data, SWAT4LS TutorialBioSamples Database Linked Data, SWAT4LS Tutorial
BioSamples Database Linked Data, SWAT4LS Tutorial
 
Joy Nelson - Workshop on BIBFRAME, RDF and SPAQL
Joy Nelson - Workshop on BIBFRAME, RDF and SPAQLJoy Nelson - Workshop on BIBFRAME, RDF and SPAQL
Joy Nelson - Workshop on BIBFRAME, RDF and SPAQL
 
SPARQLing Services
SPARQLing ServicesSPARQLing Services
SPARQLing Services
 
Introduction to Bio SPARQL
Introduction to Bio SPARQL Introduction to Bio SPARQL
Introduction to Bio SPARQL
 
Understanding the firebird optimizer
Understanding the firebird optimizerUnderstanding the firebird optimizer
Understanding the firebird optimizer
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
 
AAT LOD Microthesauri
AAT LOD MicrothesauriAAT LOD Microthesauri
AAT LOD Microthesauri
 
Towards ubiquitous OWL computing: Simplifying programmatic authoring of and q...
Towards ubiquitous OWL computing: Simplifying programmatic authoring of and q...Towards ubiquitous OWL computing: Simplifying programmatic authoring of and q...
Towards ubiquitous OWL computing: Simplifying programmatic authoring of and q...
 
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
 

Mehr von amberkhan59 (7)

Semantic Web
Semantic WebSemantic Web
Semantic Web
 
Sorting and Its Types
Sorting and Its TypesSorting and Its Types
Sorting and Its Types
 
Lec#04
Lec#04Lec#04
Lec#04
 
Lec#03
Lec#03Lec#03
Lec#03
 
Lec#02
Lec#02Lec#02
Lec#02
 
Lecture#1
Lecture#1Lecture#1
Lecture#1
 
Ict lec#9
Ict lec#9Ict lec#9
Ict lec#9
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 

Semantic Web

  • 4.  A typical query includes the following structure, some parts are optional:  Declear prefix shortcuts (optional)  PREFIX foo: <...>  Query result clause  SELECT ...  Define the dataset (optional)  FROM <...>  Query pattern  WHERE {  ...  }  Query modifiers (optional):  Group BY ...  HAVING  ORDER BY  LIMIT  OFFSET  VALUES QUERY STRUCTURE IN SPARQL
  • 5.  rdf: http://xmlns.com/foaf/0.1/  rdfs: http://www.w3.org/2000/01/rdf-schema#  owl: http://www.w3.org/2002/07/owl#  xsd: http://www.w3.org/2001/XMLSchema#  dc: http://purl.org/dc/elements/1.1/  foaf: http://xmlns.com/foaf/0.1/  obo: <http://purl.obolibrary.org/obo/> COMMON PREFIXES
  • 6.  Similar to its use in SQL, SELECT in SPARQL allows you to define which variables you want values returned and output. Like SQL you can list these individually or use an asterisk (*) to specify values for each variable. E.g.  SELECT ?a ?text  SELECT *  If you don't want duplicates you can append DISTINCT after SELECT. e.g.,  SELECT DISTINCT ?country HOW TO SELECT?
  • 7.  The WHERE clause defines where you want to find values for the variables defined in the SELECT clause. HOW TO PROGRAM INSIDE WHERE?
  • 8.  The basic unit is a triple, which is made up of three components, a subject, a predicate and an object. Each of the three components can take one of two forms:  put a ? prior to the variable name, e.g., ?a.  a Universal Resource Identifier (URI).  Note: A prefix for the namespace of the URI can be utilized.  These triples can then be concatenated together using a full-stop (.). Eventually, an interconnected graph of nodes joined by relationships is built up.  A semi-colon (;) can be used after each triple to replace the subject for the next triple if it is the same. In this way, you only need to define the predicate and object. e.g.,  ?x rdf:type mebase:User ; foaf:homepage ?homepage ; foaf:mbox ?mbox TRIPLE REPRESENTATIONS.
  • 9.  The UNION clause: return results to match at least one of multiple patterns  The OPTIONAL clause is also often used.  The FILTER clause filters the results based on certain conditions. CLAUSES
  • 10. A solution sequence modifier is one of:  Order modifier: put the solutions in order  Projection modifier: choose certain variables  Distinct modifier: ensure solutions in the sequence are unique  Reduced modifier: permit elimination of some non-distinct solutions  Offset modifier: control where the solutions start from in the overall sequence of solutions  Limit modifier: restrict the number of solutions HOW TO USE MODIFERS?
  • 11.  This section provides many examples on how to query the RDF triple store:  Example #1: Find all class-containing ontology graphs:  This example is aimed to find all ontologies in our RDF triple store. Typically every single ontology includes at least one class. This SPARQL script searches those ontology graphs in the RDF triple store that contains at least one class. SPARQL EXAMPLES TO QUERY RDF TRIPLE STORE
  • 12.  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT distinct ?graph_uri WHERE { GRAPH ?graph_uri { ?s rdf:type owl:Class } . } BELOW IS THE SPARQL SCRIPT:
  • 13.  Example #2: Find subclasses of an ontology term:  This example is aimed to find all subclasses of an ontology term.
  • 14.  PREFIX obo-term: <http://purl.obolibrary.org/obo/> SELECT DISTINCT ?x ?label FROM <http://purl.obolibrary.org/obo/merged/OAE> WHERE { ?x rdfs:subClassOf obo-term:OAE_0000001. ?x rdfs:label ?label. } BELOW IS THE SPARQL SCRIPT:
  • 15.  Example #3: Find the number of all class (or object, annotation, or datatype property) terms of an ontology:  This example is aimed to find the number of all class terms of an ontology.
  • 16.  SELECT count(?s) as ?VO_class_count FROM <http://purl.obolibrary.org/obo/merged/VO> WHERE { ?s a owl:Class . ?s rdfs:label ?label . FILTER regex( ?s, "VO_" ) } BELOW IS THE SPARQL SCRIPT:
  • 17.  Example #4: Retrieve definition and authors of all classes in an ontology:  This example is aimed to retrieve the definitions of all classes that have definitions in an ontology.
  • 18.  PREFIX obo-term: <http://purl.obolibrary.org/obo/> SELECT ?s ?label ?definition ?author FROM <http://purl.obolibrary.org/obo/merged/VO> WHERE { ?s a owl:Class . ?s rdfs:label ?label . ?s obo-term:IAO_0000115 ?definition . ?s obo-term:IAO_0000117 ?author . } BELOW IS THE SPARQL SCRIPT:
  • 19.  Example #5: Retrieve general annotations of an ontology:  This example is aimed to retrieve general annotation descriptions of the ontology. The result will return different types of annotations such as "creator", "description"s, etc.
  • 20.  PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT DISTINCT ?p, ?o FROM <http://purl.obolibrary.org/obo/merged/OAE> WHERE{ ?s a owl:Ontology . ?s ?p ?o .} BELOW IS THE SPARQL SCRIPT
  • 21.  Example #5: Query on axiom: Find vaccines containing egg protein allergen:  The above examples are mostly based on ontology annotation properties. How to perform SPARQL queries based on logical axioms with object properties (or relations)? Here we provide some example.
  • 22.  PREFIX has_vaccine_allergen: <http://purl.obolibrary.org/obo/VO_0000531> PREFIX chicken_egg_protein_allergen: <http://purl.obolibrary.org/obo/VO_0000912> SELECT distinct ?vaccine_label ?vaccine FROM <http://purl.obolibrary.org/obo/merged/VO> WHERE { ?vaccine rdfs:label ?vaccine_label . ?vaccine rdfs:subClassOf ?vaccine_restriction . ?vaccine_restriction owl:onProperty has_vaccine_allergen:; owl:someValuesFrom chicken_egg_protein_allergen: . } BELOW IS ONE SUCH SPARQL SCRIPT:
  • 23.  Prefix obo: <http://purl.obolibrary.org/obo/> SELECT distinct ?label ?s From <http://purl.obolibrary.org/obo/merged/VO> Where { ?s rdfs:label ?label . ?s rdfs:subClassOf ?s1 . ?s1 owl:onProperty obo:VO_0000531; owl:someValuesFrom obo:VO_0000912 . } NOTE THAT THE FOLLOWING CODE HAS THE SAME EFFECT AS THE TOP CODE:
  • 24.  The difference between the above two sets of SPARQL codes is that the first one looks easier to read.