其他分享
首页 > 其他分享> > 本体开发日记05-努力理解SWRL(RDF Concrete Syntax)

本体开发日记05-努力理解SWRL(RDF Concrete Syntax)

作者:互联网

RDF Concrete SyntaxRDF 具体语法

SWRL 的 RDF 模式是 swrl.rdf。SWRL 的 OWL 本体是 swrl.owl。每一个都只提供了 SWRL 语法的部分描述;OWL 本体比 RDF Schema 更完整。通过扩展OWL XML 表示语法 [ OWL XML ]的XSLT 转换,可以轻松完成从 XML 具体语法到 RDF/XML 的 转换。

swrl.rdf

<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE rdf:RDF [
         <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns'>
         <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema'>
	 <!ENTITY owl 'http://www.w3.org/2002/07/owl'>
	 <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema'>
         <!ENTITY ruleml 'http://www.w3.org/2003/11/swrl'>
         <!ENTITY swrl 'http://www.w3.org/2003/11/swrl'>
]>

<rdf:RDF
  xmlns:rdf ="&rdf;#"
  xmlns:rdfs="&rdfs;#"
  xmlns:owl ="&owl;#"
  xmlns:ruleml="&ruleml;#"
  xmlns:swrl="&swrl;#"
  xml:base  ="&swrl;"
>

<rdf:Description rdf:about="">
  <rdfs:comment>RDF Schema definition of the RDF Concrete Syntax for the Semantic Web Rule Language</rdfs:comment>
  <owl:versionInfo>$Id: swrl.rdf,v 1.11 2004/04/30 11:05:00 mdean Exp $</owl:versionInfo>
</rdf:Description>

<rdfs:Class rdf:ID="Imp">
  <rdfs:comment>implication (rule)</rdfs:comment>
</rdfs:Class>

<rdf:Property rdf:ID="head">
  <rdfs:domain rdf:resource="#Imp"/>
  <rdfs:range rdf:resource="&rdf;#List"/>
  <rdfs:comment>rule head (consequent):  List of Atom</rdfs:comment>
</rdf:Property>

<rdf:Property rdf:ID="body">
  <rdfs:domain rdf:resource="#Imp"/>
  <rdfs:range rdf:resource="&rdf;#List"/>
  <rdfs:comment>rule body (antecedent):  List of Atom</rdfs:comment>
</rdf:Property>

<rdfs:Class rdf:ID="Variable">
  <rdfs:comment>indicate that a URI is being used as a variable</rdfs:comment>
</rdfs:Class>

<rdfs:Class rdf:ID="Atom">
  <rdfs:comment>common superclass</rdfs:comment>
</rdfs:Class>

<rdf:Property rdf:ID="argument1">
  <rdfs:domain rdf:resource="#Atom"/>
  <rdfs:range rdf:resource="&rdfs;#Resource"/>
</rdf:Property>

<rdf:Property rdf:ID="argument2">
  <rdfs:domain rdf:resource="#Atom"/>
  <rdfs:comment>can be a Literal or Resource</rdfs:comment>
</rdf:Property>

<rdfs:Class rdf:ID="ClassAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a classPredicate and argument1</rdfs:comment>
</rdfs:Class>

<rdf:Property rdf:ID="classPredicate">
  <rdfs:domain rdf:resource="#ClassAtom"/>
  <rdfs:range rdf:resource="&rdfs;#Class"/>
</rdf:Property>

<rdfs:Class rdf:ID="IndividualPropertyAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a propertyPredicate (owl:ObjectProperty), argument1 (owl:Thing), and argument2 (owl:Thing)</rdfs:comment>
</rdfs:Class>

<rdf:Property rdf:ID="propertyPredicate">
  <rdfs:domain rdf:resource="#Atom"/>
  <rdfs:range rdf:resource="&rdf;#Property"/>
</rdf:Property>

<rdfs:Class rdf:ID="DatavaluedPropertyAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a propertyPredicate (owl:DatatypeProperty), argument1 (owl:Thing), and argument2 (rdfs:Literal)</rdfs:comment>
</rdfs:Class>

<rdfs:Class rdf:ID="SameIndividualAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of argument1 (owl:Thing) and argument2 (owl:Thing)</rdfs:comment>
</rdfs:Class>

<rdfs:Class rdf:ID="DifferentIndividualsAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of argument1 (owl:Thing) and argument2 (owl:Thing)</rdfs:comment>
</rdfs:Class>

<rdfs:Class rdf:ID="BuiltinAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a builtin and a List of arguments</rdfs:comment>
</rdfs:Class>

<rdfs:Class rdf:ID="Builtin"/>

<!-- enumerate Builtins -->

<rdf:Property rdf:ID="builtin">
  <rdfs:domain rdf:resource="#BuiltinAtom"/>
  <rdfs:range rdf:resource="#Builtin"/>
</rdf:Property>

<rdf:Property rdf:ID="arguments">
  <rdfs:domain rdf:resource="#BuiltinAtom"/>
  <rdfs:range rdf:resource="&rdf;#List"/>
</rdf:Property>

<rdfs:Class rdf:ID="DataRangeAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a dataRange and argument1</rdfs:comment>
</rdfs:Class>

<rdf:Property rdf:ID="dataRange">
  <rdfs:domain rdf:resource="#DataRangeAtom"/>
  <rdfs:range rdf:resource="&owl;#DataRange"/>
</rdf:Property>

</rdf:RDF>

swrl.owl

<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE rdf:RDF [
         <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns'>
         <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema'>
	 <!ENTITY owl 'http://www.w3.org/2002/07/owl'>
	 <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema'>
         <!ENTITY ruleml 'http://www.w3.org/2003/11/swrl'>
         <!ENTITY swrl 'http://www.w3.org/2003/11/swrl'>
]>

<rdf:RDF
  xmlns:rdf ="&rdf;#"
  xmlns:rdfs="&rdfs;#"
  xmlns:owl ="&owl;#"
  xmlns:ruleml="&ruleml;#"
  xmlns:swrl="&swrl;#"
  xml:base  ="&swrl;"
>

<owl:Ontology rdf:about="">
  <rdfs:comment>OWL definition of the RDF Concrete Syntax for the Semantic Web Rule Language</rdfs:comment>
  <owl:versionInfo>$Id: swrl.owl,v 1.15 2004/11/09 11:58:28 mdean Exp $</owl:versionInfo>
</owl:Ontology>

<owl:Class rdf:ID="Imp">
  <rdfs:comment>implication (rule)</rdfs:comment>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#head"/>
      <owl:allValuesFrom rdf:resource="#AtomList"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#head"/>
      <owl:maxCardinality>1</owl:maxCardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#body"/>
      <owl:allValuesFrom rdf:resource="#AtomList"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#body"/>
      <owl:maxCardinality>1</owl:maxCardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<owl:ObjectProperty rdf:ID="head">
  <rdfs:comment>rule head (consequent):  List of Atom</rdfs:comment>
</owl:ObjectProperty>

<owl:ObjectProperty rdf:ID="body">
  <rdfs:comment>rule body (antecedent):  List of Atom</rdfs:comment>
</owl:ObjectProperty>

<owl:Class rdf:ID="Variable">
  <rdfs:comment>indicate that a URI is being used as a variable</rdfs:comment>
</owl:Class>

<owl:Class rdf:ID="Atom">
  <rdfs:comment>common superclass</rdfs:comment>
</owl:Class>

<owl:Class rdf:ID="AtomList">
  <rdfs:subClassOf rdf:resource="&rdf;#List"/>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="&rdf;#first"/>
      <owl:allValuesFrom rdf:resource="#Atom"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="&rdf;#first"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="&rdf;#rest"/>
      <owl:allValuesFrom rdf:resource="#AtomList"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="&rdf;#rest"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<swrl:AtomList rdf:about="&rdf;#nil"/>

<owl:ObjectProperty rdf:ID="argument1"/>

<rdf:Property rdf:ID="argument2">
  <rdfs:comment>can be a Literal or Resource</rdfs:comment>
</rdf:Property>

<owl:Class rdf:ID="ClassAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a classPredicate and argument1</rdfs:comment>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#classPredicate"/>
      <owl:allValuesFrom rdf:resource="&owl;#Class"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#classPredicate"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<owl:ObjectProperty rdf:ID="classPredicate"/>

<owl:Class rdf:ID="IndividualPropertyAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a propertyPredicate (owl:ObjectProperty), argument1 (owl:Thing), and argument2 (owl:Thing)</rdfs:comment>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#propertyPredicate"/>
      <owl:allValuesFrom rdf:resource="&owl;#ObjectProperty"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#propertyPredicate"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument2"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument2"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<owl:ObjectProperty rdf:ID="propertyPredicate"/>

<owl:Class rdf:ID="DatavaluedPropertyAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a propertyPredicate (owl:DatatypeProperty), argument1 (owl:Thing), and argument2 (rdfs:Literal)</rdfs:comment>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#propertyPredicate"/>
      <owl:allValuesFrom rdf:resource="&owl;#DatatypeProperty"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#propertyPredicate"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument2"/>
      <owl:allValuesFrom rdf:resource="&rdfs;#Literal"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument2"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<owl:Class rdf:ID="SameIndividualAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of argument1 (owl:Thing) and argument2 (owl:Thing)</rdfs:comment>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument2"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument2"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<owl:Class rdf:ID="DifferentIndividualsAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of argument1 (owl:Thing) and argument2 (owl:Thing)</rdfs:comment>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument2"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument2"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<owl:Class rdf:ID="BuiltinAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a builtin and a List of arguments</rdfs:comment>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#builtin"/>
      <owl:allValuesFrom rdf:resource="#Builtin"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#builtin"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#arguments"/>
      <owl:allValuesFrom rdf:resource="&rdf;#List"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#arguments"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<owl:Class rdf:ID="Builtin"/>

<!-- enumerate Builtins -->

<owl:ObjectProperty rdf:ID="builtin"/>

<owl:ObjectProperty rdf:ID="arguments"/>

<owl:Class rdf:ID="DataRangeAtom">
  <rdfs:subClassOf rdf:resource="#Atom"/>
  <rdfs:comment>consists of a dataRange and argument1</rdfs:comment>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#dataRange"/>
      <owl:allValuesFrom rdf:resource="&owl;#DataRange"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#dataRange"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:allValuesFrom rdf:resource="&owl;#Thing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#argument1"/>
      <owl:cardinality>1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

<owl:ObjectProperty rdf:ID="dataRange"/>

</rdf:RDF>

6.1. RDF 具体语法中的规则示例

这些示例说明了 OWL RDF/XML 语法的合适规则扩展。
下面的例子是5.1.3的扩展

<swrl:Variable rdf:ID="x1"/>
<swrl:Variable rdf:ID="x2"/>
<swrl:Variable rdf:ID="x3"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasParent"/> 
      <swrl:argument1 rdf:resource="#x1" />
      <swrl:argument2 rdf:resource="#x2" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasSibling"/> 
      <swrl:argument1 rdf:resource="#x2" />
      <swrl:argument2 rdf:resource="#x3" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasSex"/> 
      <swrl:argument1 rdf:resource="#x3" />
      <swrl:argument2 rdf:resource="#male" />
    </swrl:IndividualPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasUncle"/> 
      <swrl:argument1 rdf:resource="#x1" />
      <swrl:argument2 rdf:resource="#x3" />
    </swrl:IndividualPropertyAtom>
  </ruleml:head> 
</ruleml:Imp> 

下面是5.1.4的扩展

<swrl:Variable rdf:ID="x"/>
<swrl:Variable rdf:ID="y"/>
<swrl:Variable rdf:ID="z"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&ulan;Artist"/> 
      <swrl:argument1 rdf:resource="#x" />
    </swrl:ClassAtom>
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&aat;Style"/> 
      <swrl:argument1 rdf:resource="#y" />
    </swrl:ClassAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&aatulan;artistStyle"/> 
      <swrl:argument1 rdf:resource="#x" />
      <swrl:argument2 rdf:resource="#y" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&vra;creator"/> 
      <swrl:argument1 rdf:resource="#x" />
      <swrl:argument2 rdf:resource="#z" />
    </swrl:IndividualPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&vra;style/period"/> 
      <swrl:argument1 rdf:resource="#z" />
      <swrl:argument2 rdf:resource="#y" />
    </swrl:IndividualPropertyAtom>
  </ruleml:head> 
</ruleml:Imp> 

下面不知道!!

<swrl:Variable rdf:ID="airport"/>
<swrl:Variable rdf:ID="loc"/>
<swrl:Variable rdf:ID="name"/>
<swrl:Variable rdf:ID="lat"/>
<swrl:Variable rdf:ID="lon"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&airport-ont;Airport"/> 
      <swrl:argument1 rdf:resource="#airport" />
    </swrl:ClassAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#location"/> 
      <swrl:argument1 rdf:resource="#airport" />
      <swrl:argument2 rdf:resource="#loc" />
    </swrl:IndividualPropertyAtom>
    <swrl:DatavaluedPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#latitude"/> 
      <swrl:argument1 rdf:resource="#loc" />
      <swrl:argument2 rdf:resource="#lat" />
    </swrl:DatavaluedPropertyAtom>
    <swrl:DatavaluedPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#longitude"/> 
      <swrl:argument1 rdf:resource="#loc" />
      <swrl:argument2 rdf:resource="#lon" />
    </swrl:DatavaluedPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:ClassAtom> 
      <swrl:classPredicate>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#sameLocation"/>
          <owl:someValuesFrom>
            <owl:Class>
              <owl:intersectionOf rdf:parseType="Collection">
                <owl:Class rdf:about="&map;Location"/>
                <owl:Restriction>
                  <owl:onProperty rdf:resource="&map;isLocationOf"/>
                  <owl:someValuesFrom>
                    <owl:Class>
                      <owl:intersectionOf rdf:parseType="Collection">
                        <owl:Class rdf:about="&map;Point"/>
                        <owl:Restriction>
                          <owl:onProperty rdf:resource="&map;isObjectOf"/>
                          <owl:someValuesFrom>
                            <owl:Class>
                              <owl:oneOf rdf:parseType="Collection">
                                <owl:Item rdf:resource="#layer"/>
                              </owl:oneOf>
                            </owl:Class>
                          </owl:someValuesFrom>
                        </owl:Restriction>
                      </owl:intersectionOf>
                    </owl:Class>
                  </owl:someValuesFrom>
                </owl:Restriction>
              </owl:intersectionOf>
            </owl:Class>
          </owl:someValuesFrom>
        </owl:Restriction>
      </swrl:classPredicate> 
      <swrl:argument1 rdf:resource="#airport" />
    </swrl:ClassAtom>
  </ruleml:head> 
</ruleml:Imp> 

上面的源文件

6-1-3

<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE rdf:RDF [
         <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns'>
         <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema'>
	 <!ENTITY owl 'http://www.w3.org/2002/07/owl'>
	 <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema'>
         <!ENTITY ruleml 'http://www.w3.org/2003/11/swrl'>
         <!ENTITY swrl 'http://www.w3.org/2003/11/swrl'>
	 <!ENTITY map 'http://www.daml.org/2001/06/map/map-ont#'>
         <!ENTITY airport 'http://www.daml.org/cgi-bin/airport?'>
         <!ENTITY airport-ont 'http://www.daml.org/2001/10/html/airport-ont#'>
]>

<rdf:RDF
  xmlns:rdf ="&rdf;#"
  xmlns:rdfs="&rdfs;#"
  xmlns:owl ="&owl;#"
  xmlns:ruleml="&ruleml;#"
  xmlns:swrl="&swrl;#"
>

<owl:Ontology rdf:about="">
  <rdfs:comment>SWRL Example 6.1-3</rdfs:comment>
  <owl:versionInfo>$Id: example6.1-3.owl,v 1.2 2004/04/30 12:18:52 mdean Exp $</owl:versionInfo>
  <owl:imports rdf:resource="&swrl;"/>
  <owl:imports rdf:resource="&airport-ont;"/>
  <owl:imports rdf:resource="&map;"/>
</owl:Ontology>

<swrl:Variable rdf:ID="airport"/>
<swrl:Variable rdf:ID="loc"/>
<swrl:Variable rdf:ID="name"/>
<swrl:Variable rdf:ID="lat"/>
<swrl:Variable rdf:ID="lon"/>

<owl:DatatypeProperty rdf:ID="latitude"/>
<owl:DatatypeProperty rdf:ID="longitude"/>

<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&airport-ont;Airport"/> 
      <swrl:argument1 rdf:resource="#airport" />
    </swrl:ClassAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#location"/> 
      <swrl:argument1 rdf:resource="#airport" />
      <swrl:argument2 rdf:resource="#loc" />
    </swrl:IndividualPropertyAtom>
    <swrl:DatavaluedPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#latitude"/> 
      <swrl:argument1 rdf:resource="#loc" />
      <swrl:argument2 rdf:resource="#lat" />
    </swrl:DatavaluedPropertyAtom>
    <swrl:DatavaluedPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#longitude"/> 
      <swrl:argument1 rdf:resource="#loc" />
      <swrl:argument2 rdf:resource="#lon" />
    </swrl:DatavaluedPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:ClassAtom> 
      <swrl:classPredicate>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#sameLocation"/>
          <owl:someValuesFrom>
            <owl:Class>
              <owl:intersectionOf rdf:parseType="Collection">
                <owl:Class rdf:about="&map;Location"/>
                <owl:Restriction>
                  <owl:onProperty rdf:resource="&map;isLocationOf"/>
                  <owl:someValuesFrom>
                    <owl:Class>
                      <owl:intersectionOf rdf:parseType="Collection">
                        <owl:Class rdf:about="&map;Point"/>
                        <owl:Restriction>
                          <owl:onProperty rdf:resource="&map;isObjectOf"/>
                          <owl:someValuesFrom>
                            <owl:Class>
                              <owl:oneOf rdf:parseType="Collection">
                                <owl:Item rdf:about="#layer"/>
                              </owl:oneOf>
                            </owl:Class>
                          </owl:someValuesFrom>
                        </owl:Restriction>
                      </owl:intersectionOf>
                    </owl:Class>
                  </owl:someValuesFrom>
                </owl:Restriction>
              </owl:intersectionOf>
            </owl:Class>
          </owl:someValuesFrom>
        </owl:Restriction>
      </swrl:classPredicate> 
      <swrl:argument1 rdf:resource="#airport" />
    </swrl:ClassAtom>
  </ruleml:head> 
</ruleml:Imp> 

</rdf:RDF>

标签:SWRL,owl,05,Syntax,Thing,RDF,argument2,argument1,consists
来源: https://blog.csdn.net/weixin_45799003/article/details/121015152