SeRQL examples for MMI ontologies
Examples to understand SeRQL, which is the query language used to query MMI Ontologies via SOAP Web Services.
Introduction
SeRQL is a query language, similar to SQL, that allows quering of ontologies expressed in RDF. This document presents examples of SeRQL constructions used to query the MMI ontologies via SOAP Web Services (/examples/mmihostedwork/ontologieswork/ontwebservices/).
Format of the examples
The examples presented have the following format:- Purpose of the QUERY.
- The query contruction in SeRQL.
- Notes reagarding the query
- Result of the query
Query on the Web
To test your own queries or the ones presented here you can go to this web page: http://marinemetadata.org:9600/mmiws/
SeRQL Examples
- Get all the URIs of the ontologies:
- CONSTRUCT * FROM {a} p {<http://www.w3.org/2002/07/owl#Ontology>}
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/argo-param">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gts">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/mapping-habitats">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/prd_xbt">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
...
</rdf:RDF> - Get all the properties of the ontologies:
- Is the properties of the ontology. Different than the properties declared in the ontology. In other words is the metadata of that ontology. At MMI the ontologies have Dublin Core Metadata, allowing to know more about each ontology.
- CONSTRUCT * FROM {<http://marinemetadata.org/2005/08/ssds-param>} p {b}
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ns3="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/ssds-param">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
<ns3:date>2005-08-04T03:02:21</ns3:date>
<ns3:description>SSDS parameters in an ontology. A CSV was generated from the database and an automatic conversion was created by MMI.
More information: http://ssdspub.mbari.org/http://ssdspub.mbari.org/</ns3:description>
<ns3:source>SSDS Shore Side Data System (SSDS)</ns3:source>
<ns3:subject>parameters</ns3:subject>
<ns3:contributor>Kevin Gomez</ns3:contributor>
<ns3:creator>Luis Bermudez MMI</ns3:creator>
<ns3:title>SSDS Parameters</ns3:title>
</rdf:Description>
</rdf:RDF> - Get the title of an ontology:
- CONSTRUCT * FROM {<http://marinemetadata.org/2005/08/ssds-param>} <http://purl.org/dc/elements/1.1/title> {b}
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ns2="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/ssds-param">
<ns2:title>SSDS Parameters</ns2:title>
</rdf:Description>
</rdf:RDF> - Get all the the classes in an ontology:
- CONSTRUCT * FROM {a} rdf:type {owl:Class} WHERE NAMESPACE(a) =<http://marinemetadata.org/2005/08/gcmd-keyw#>
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Term">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Category">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Variable">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Topic">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
</rdf:RDF> - Get all the instances of a class:
- CONSTRUCT * FROM {a} rdf:type {<http://marinemetadata.org/2005/08/gcmd-keyw#Topic>}
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Hydrosphere">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Climate_Indicators">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Human_Dimensions">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Sun-earth_Interactions">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Land_Surface">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Spectral_Engineering">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Agriculture">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Cryosphere">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Biosphere">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Solid_Earth">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Paleoclimate">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Oceans">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Atmosphere">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
</rdf:RDF> - Get all the properties of a resource:
- CONSTRUCT * FROM {<http://marinemetadata.org/2005/08/bodc-param#CPHLSSPC>} p {x}
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:ns1="http://marinemetadata.org/2005/08/bodc-param#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ns2="http://marinemetada.org/2005/06/mapper#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/bodc-param#CPHLSSPC">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/bodc-param#Parameter"/>
<ns2:narrowerThan rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Chlorophyll"/>
<rdfs:label>CPHLSSPC</rdfs:label>
<ns1:unit_code>UMMC</ns1:unit_code>
<ns1:code>CPHLSSPC</ns1:code>
<ns1:short_title>JHSpec_Chl-a_centrifug</ns1:short_title>
<ns1:definition>Trichromatic spectrophotometric assay following the Jeffrey and Humphrey protocols on an acetone extract from particulates collected using a centrifuge.</ns1:definition>
<ns1:full_title>Concentration of chlorophyll-a {chl-a} per unit volume of the water column [particulate phase] by centrifugation, acetone extraction and trichromatic spectrophotometry following the Jeffrey and Humphrey protocol</ns1:full_title>
<ns1:group_code>CPWC</ns1:group_code>
</rdf:Description>
</rdf:RDF> - Get the RDF label of a resource:
- CONSTRUCT * FROM {<http://marinemetadata.org/2005/08/gcmd-keyw#Salinity_Density>} rdfs:label {x}
- <rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Salinity_Density">
<rdfs:label>Salinity/Density</rdfs:label>
</rdf:Description>
</rdf:RDF>
- Get same as and narrower terms of a resource:
- CONSTRUCT * FROM{a} p {<http://marinemetadata.org/2005/08/seacoos#current_speed>} WHERE ( p = <http://www.w3.org/2002/07/owl#sameAs> OR p = <http://marinemetada.org/2005/06/mapper#narrowerThan> )
- CONSTRUCT * FROM{<http://marinemetadata.org/2005/08/seacoos#current_speed>} p {b} WHERE ( p = <http://www.w3.org/2002/07/owl#sameAs> OR p = <http://marinemetada.org/2005/06/mapper#broaderThan> )
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ns4="http://marinemetada.org/2005/06/mapper#"
xmlns:ns2="http://www.w3.org/2002/07/owl#">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/seacoos#current_speed">
<ns2:sameAs rdf:resource="http://marinemetadata.org/2005/08/epic-units#CURRENT_SPEED_CM_S"/>
<ns2:sameAs rdf:resource="http://marinemetadata.org/2005/08/seacoos#current_speed"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAAP02"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAAP01"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCVSAC04"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAEL02"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAEL01"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSATFBL"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCVSAC03"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCVSAC02"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAEL04"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCVSAC01"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAEL03"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSALA01"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAEM01"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAAP03"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAZZ01"/>
<ns4:broaderThan rdf:resource="http://marinemetadata.org/2005/08/bodc-param#LCSAAS01"/>
</rdf:Description>
</rdf:RDF> - Get all the properties define by MMI to map terms:
- CONSTRUCT * FROM {a} rdf:type {c} WHERE NAMESPACE(a)= <http://marinemetada.org/2005/06/mapper#>
- narrowerThan and BroaderThan relations were defined at MMI. The sameAs relation was not defined because the owl:sameAs relation was used instead.
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://marinemetada.org/2005/06/mapper#narrowerThan">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetada.org/2005/06/mapper#broaderThan">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
</rdf:Description>
</rdf:RDF> - Get all the object properties of an ontology:
- CONSTRUCT * FROM {a} rdf:type {owl:ObjectProperty} WHERE NAMESPACE(a)= <http://marinemetadata.org/2005/08/gcmd-keyw#>
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#isTermOfTopic">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#isVariableOfTerm">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#isTopicOfTerm">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#isCategoryOfTopic">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#isTopicOfCategory">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#isTermOfVariable">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
</rdf:RDF> - Get the GCMD hierarchy for the term pneumatophore declared in the CORIS ontology:
- The call will retrieve all the information in XML, neccesary to construct the GCMD hierarchy, based on the resources declared in the ontology.
- CONSTRUCT * FROM {coris:pneumatophore} p {variable},
{variable} rdf:type {gcmd:Variable},
{variable} gcmd:isVariableOfTerm {term},
{term} gcmd:isTermOfTopic {topic},
{topic} gcmd:isTopicOfCategory {category},
{term} rdf:type {c},
{topic} rdf:type {d},
{category} rdf:type {e}
WHERE p=owl:sameAs OR p=mmi:narrowerThan
USING NAMESPACE
coris=<http://marinemetadata.org/2005/08/coris#>,
gcmd=<http://marinemetadata.org/2005/08/gcmd-keyw#>,
mmi=<http://marinemetada.org/2005/06/mapper#>
- <?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:ns3="http://marinemetadata.org/2005/08/gcmd-keyw#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ns2="http://marinemetada.org/2005/06/mapper#">
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Coastal_Processes">
<ns3:isTermOfTopic rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Oceans"/>
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Term"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Mangroves">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Variable"/>
<ns3:isVariableOfTerm rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Coastal_Processes"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#EARTH_SCIENCE">
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Category"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/gcmd-keyw#Oceans">
<ns3:isTopicOfCategory rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#EARTH_SCIENCE"/>
<rdf:type rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Topic"/>
</rdf:Description>
<rdf:Description rdf:about="http://marinemetadata.org/2005/08/coris#pneumatophore">
<ns2:narrowerThan rdf:resource="http://marinemetadata.org/2005/08/gcmd-keyw#Mangroves"/>
</rdf:Description>
</rdf:RDF>
Posted February 27th, 2007 by luisBer
