STRL : Semantic Translation Rule Language

From VoCamp Wiki
Jump to: navigation, search
  • (Please edit the wiki page and copy-paste the RDF)
  • The namespace is currently lingvoj.org, this would have to be changed.
  • Thanks to Bernard Vatant who came up with the initial idea.
  • RuleSet : a set of rules
    • Source dataset : the source dataset on which the rule applies;
    • Target dataset : the target dataset this rule generates;
    • hasRule : list of rules contained in the set
  • Rule : a rule
    • rule text : the text content of the rule (i.e SPARQL CONSTRUCT query, or RIF, etc.)
    • rule link : link to a file/URL containing the rule
    • hasRuleLanguage : language in which the rule is expressed
    • sourceElement : the class or property in the source model that is transformed by this rule
    • targetElement : the class or property in the target model that is generated by this rule
    • sourceLanguage : the source model/ontology this rule transforms
    • targetLanguage : the target model/ontology that the rule generates
    • inSet : inverseOf hasRule
  • RuleLanguage : a rule language (i.e. SPARQL, RIF, SWRL, etc.)




<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE rdf:RDF [

 <!ENTITY owl "http://www.w3.org/2002/07/owl#">
 <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
 <!ENTITY strl "http://www.lingvoj.org/strl#">
 <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">

]> <rdf:RDF xml:base="http://www.lingvoj.org/strl"

        xmlns:owl="&owl;"
        xmlns:rdf="&rdf;"
        xmlns:rdfs="&rdfs;"
        xmlns:strl="&strl;">
 <owl:Ontology rdf:about=""
               owl:versionInfo="v1.0  2010-02-03">
   <rdfs:comment xml:lang="en">A language for defining SPARQL transformation rule sets across RDF vocabularies.</rdfs:comment>
   <rdfs:label xml:lang="en">Semantic Translation Rule Language</rdfs:label>
 </owl:Ontology>
 <owl:Class rdf:about="#Rule">
   <rdfs:comment xml:lang="en">A Translation Rule specifies a SPARQL query, and the elements of the source vocabulary and target vocabulary involved in the translation.</rdfs:comment>
   <rdfs:label xml:lang="en">Translation Rule</rdfs:label>
 </owl:Class>
 <owl:Class rdf:about="#RuleLanguage"
            rdfs:label="Rule Language">
   <rdfs:comment xml:lang="en">The language in which a rule is expressed. Exemple of rule language are SPARQL, RIF or SWRL.</rdfs:comment>
 </owl:Class>
 <owl:Class rdf:about="#RuleSet">
   <rdfs:comment xml:lang="en">A Translation Rule Set specifies its source and target vocabulary, and the rules belonging to it.</rdfs:comment>
   <rdfs:label xml:lang="en">Translation Rule Set</rdfs:label>
 </owl:Class>
 <owl:AnnotationProperty rdf:about="&rdfs;comment"/>
 <owl:AnnotationProperty rdf:about="&rdfs;label"/>
 <owl:AnnotationProperty rdf:about="&owl;versionInfo"/>
 <owl:DatatypeProperty rdf:about="#ruleQueryText">
   <rdfs:comment xml:lang="en">Use this property to encapsulate directly the text of the SPARQL CONSTRUCT defining the rule</rdfs:comment>
   <rdfs:domain rdf:resource="#Rule"/>
   <rdfs:label xml:lang="en">rule query text</rdfs:label>
 </owl:DatatypeProperty>
 <owl:ObjectProperty rdf:about="#hasRule">
   <rdfs:comment xml:lang="en">A Rule belonging to the Rule Set</rdfs:comment>
   <rdfs:domain rdf:resource="#RuleSet"/>
   <rdfs:label xml:lang="en">has rule</rdfs:label>
   <rdfs:range rdf:resource="#Rule"/>
   <owl:inverseOf rdf:resource="#inSet"/>
 </owl:ObjectProperty>
 <owl:ObjectProperty rdf:about="#hasRuleLanguage"
                     rdfs:label="has rule language">
   <rdfs:domain rdf:resource="#Rule"/>
   <rdfs:range rdf:resource="#RuleLanguage"/>
 </owl:ObjectProperty>
 <owl:ObjectProperty rdf:about="#inSet">
   <rdfs:comment xml:lang="en">A Rule Set the Rule is part of.</rdfs:comment>
   <rdfs:domain rdf:resource="#Rule"/>
   <rdfs:label xml:lang="en">in set</rdfs:label>
   <rdfs:range rdf:resource="#RuleSet"/>
   <owl:inverseOf rdf:resource="#hasRule"/>
 </owl:ObjectProperty>
 <owl:ObjectProperty rdf:about="#ruleQueryLink">
   <rdfs:comment xml:lang="en">Use this property to link to a resource providing the text of the SPARQL CONSTRUCT defining the rule</rdfs:comment>
   <rdfs:domain rdf:resource="#Rule"/>
   <rdfs:label xml:lang="en">rule query link</rdfs:label>
 </owl:ObjectProperty>
 <owl:ObjectProperty rdf:about="#sourceElement">
   <rdfs:comment xml:lang="en">An element of the source language involved in the translation Rule</rdfs:comment>
   <rdfs:domain rdf:resource="#Rule"/>
   <rdfs:label xml:lang="en">source language</rdfs:label>
 </owl:ObjectProperty>
 <owl:ObjectProperty rdf:about="#sourceLanguage">
   <rdfs:comment xml:lang="en">The source language (ontology, vocabulary) of the translation Rules in the Rule set.</rdfs:comment>
   <rdfs:domain rdf:resource="#RuleSet"/>
   <rdfs:label xml:lang="en">source language</rdfs:label>
 </owl:ObjectProperty>
 <owl:ObjectProperty rdf:about="#targetElement">
   <rdfs:comment xml:lang="en">An element of the target language involved in the translation Rule</rdfs:comment>
   <rdfs:domain rdf:resource="#Rule"/>
   <rdfs:label xml:lang="en">target language</rdfs:label>
 </owl:ObjectProperty>
 <owl:ObjectProperty rdf:about="#targetLanguage">
   <rdfs:comment xml:lang="en">The target language (ontology, vocabulary) of the translation Rules in the Rule set.</rdfs:comment>
   <rdfs:domain rdf:resource="#RuleSet"/>
   <rdfs:label xml:lang="en">target language</rdfs:label>
 </owl:ObjectProperty>
 <strl:RuleLanguage rdf:about="#RIF"
                    rdfs:label="RIF"/>
 <strl:RuleLanguage rdf:about="#SPARQL"
                    rdfs:label="SPARQL Construct"/>
 <strl:RuleLanguage rdf:about="#SWRL"
                    rdfs:label="SWRL"/>
 <owl:Thing rdf:about="http://www.geonames.org/ontology"/>
 <owl:Thing rdf:about="http://www.geonames.org/ontology#Feature"/>
 <owl:Thing rdf:about="http://www.geonames.org/ontology#alternateName"/>
 <owl:Thing rdf:about="http://www.geonames.org/ontology#featureClass"/>
 <owl:Thing rdf:about="http://www.geonames.org/ontology#name"/>
 <strl:RuleSet rdf:about="http://www.lingvoj.org/examples/GeonamesToSKOS">
   <strl:hasRule rdf:resource="http://www.lingvoj.org/examples/GeonamesToSKOS#R1"/>
   <strl:hasRule rdf:resource="http://www.lingvoj.org/examples/GeonamesToSKOS#R2"/>
   <strl:sourceLanguage rdf:resource="http://www.geonames.org/ontology"/>
   <strl:targetLanguage rdf:resource="http://www.w3.org/2004/02/skos/core"/>
   <rdfs:comment xml:lang="en">This Example Rule Set is used to transform the geonames administrative features and populated places with population over 10,000 in France into a skos:ConceptScheme.</rdfs:comment>
   <rdfs:label xml:lang="en">Geonames France to SKOS</rdfs:label>
 </strl:RuleSet>
 <strl:Rule rdf:about="http://www.lingvoj.org/examples/GeonamesToSKOS#R1">
   <strl:inSet rdf:resource="http://www.lingvoj.org/examples/GeonamesToSKOS"/>
   <strl:ruleQueryText>PREFIX  geo:   <http://www.geonames.org/ontology#>
     PREFIX  skos:  <http://www.w3.org/2004/02/skos/core#>
     
     CONSTRUCT 
     {
     ?x   a  skos:Concept.
     ?x   skos:prefLabel ?pref.
     ?x   skos:altLabel ?alt.
     ?x   skos:inScheme  geo:FR
     }
     
     WHERE
     {
     ?x   a  geo:Feature.
     ?x geo:countryCode 'FR'.
     {
     {?x   geo:featureClass  geo:A}
     UNION
     {?x   geo:featureClass  geo:PPL.
     ?x    geo:population  ?p.
     FILTER (?p > 10000}
     }
     ?x   geo:name ?pref.
     OPTIONAL{ ?x   geo:alternateName ?alt. }
     }</strl:ruleQueryText>
   <strl:sourceElement rdf:resource="http://www.geonames.org/ontology#Feature"/>
   <strl:sourceElement rdf:resource="http://www.geonames.org/ontology#alternateName"/>
   <strl:sourceElement rdf:resource="http://www.geonames.org/ontology#featureClass"/>
   <strl:sourceElement rdf:resource="http://www.geonames.org/ontology#name"/>
   <strl:targetElement rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>
   <strl:targetElement rdf:resource="http://www.w3.org/2004/02/skos/core#altLabel"/>
   <strl:targetElement rdf:resource="http://www.w3.org/2004/02/skos/core#prefLabel"/>
   <rdfs:comment>Translation of geonames Feature instances with feature class "A" into skos:Concept with preflabel and altlabel</rdfs:comment>
   <rdfs:label xml:lang="en">Geonames to SKOS Rule 1</rdfs:label>
 </strl:Rule>
 <strl:Rule rdf:about="http://www.lingvoj.org/examples/GeonamesToSKOS#R2">
   <strl:inSet rdf:resource="http://www.lingvoj.org/examples/GeonamesToSKOS"/>
   <strl:ruleQueryText>PREFIX  geo:   <http://www.geonames.org/ontology#>
     PREFIX  skos:  <http://www.w3.org/2004/02/skos/core#>
     
     CONSTRUCT 
     {
     ?x   skos:broader  ?b
     }
     
     WHERE
     {
      ?x   a  geo:Feature.
      ?x geo:countryCode 'FR'.
     {
     {?x   geo:featureClass  geo:A}
     UNION
     {?x   geo:featureClass  geo:PPL.
     ?x  geo:population  ?p.
     FILTER (?p > 10000}
     }
     ?x  parentFeature  ?b 
     }</strl:ruleQueryText>
   <strl:sourceElement rdf:resource="http://www.geonames.org/ontology#Feature"/>
   <strl:sourceElement rdf:resource="http://www.geonames.org/ontology#featureClass"/>
   <strl:targetElement rdf:resource="http://www.w3.org/2004/02/skos/core#broader"/>
   <rdfs:comment>Translation of geonames parent feature into skos:broader</rdfs:comment>
   <rdfs:label xml:lang="en">Geonames to SKOS Rule 2</rdfs:label>
 </strl:Rule>
 <owl:Thing rdf:about="http://www.w3.org/2004/02/skos/core"/>
 <owl:Thing rdf:about="http://www.w3.org/2004/02/skos/core#Concept"/>
 <owl:Thing rdf:about="http://www.w3.org/2004/02/skos/core#altLabel"/>
 <owl:Thing rdf:about="http://www.w3.org/2004/02/skos/core#broader"/>
 <owl:Thing rdf:about="http://www.w3.org/2004/02/skos/core#prefLabel"/>

</rdf:RDF>