2013-08-07 7 views
2

J'ai des propriétés d'objet nommées employ et employedBy car elles sont inverses l'une de l'autre. Comment donner ces propriétés à une instance? Mon employ propriété:Comment décrire une propriété incluant reverseOf à une instance dans la syntaxe OWL-RDF/XML?

<owl:ObjectProperty rdf:ID="employ"> 
    <rdf:type rdf:resource="http://rdf.pozitron.com/organizations/" /> 
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/organizations/"/> 
    <rdfs:range rdf:resource="http://rdf.pozitron.com/people/"/> 
</owl:ObjectProperty> 

Mon employedBy propriété:

<owl:ObjectProperty rdf:ID="employedBy"> 
    <rdf:type rdf:resource="http://rdf.pozitron.com/people/" /> 
    <owl:inverseOf rdf:resource="#Employ" /> 
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/people/"/> 
    <rdfs:range rdf:resource="http://rdf.pozitron.com/organizations/"/> 
</owl:ObjectProperty> 

maintenant comment décrire employ et employedBy dans ce cas? Supposons que Pozitron emploie John et John est employé par Pozitron.

<rdf:Description rdf:about="http://rdf.pozitron.com/people/john"> 
    <rdf:type rdf:resource="http://rdf.pozitron.com/people/"/> 
    <person:personName>John</person:personName> 
    <organization:organizationName>Pozitron</organization:organizationName> 
</rdf:Description> 
+0

Dans vos données, 'john' a un' organizationName' de '" Pozitron' ". Est-ce que 'john' devrait avoir un nom d'organisation? Devrait-il y avoir une organisation «Pozitron» avec ce nom à la place? –

+1

Comme conseillé dans une question précédente: utiliser Tortue. Arrêtez d'utiliser RDF/XML. Tu ne fais que rendre la vie plus dure pour toi. –

Répondre

5

Il est beaucoup plus facile d'écrire RDF dans une syntaxe comme Turtle que RDF/XML. Les données que vous avez fournies ne nous suffisent pas (par exemple, l'URI de base n'est pas définie). Voici un document RDF/XML complet avec vos données (notez l'espace de noms ex):

<rdf:RDF 
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    xmlns:owl="http://www.w3.org/2002/07/owl#" 
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
    xmlns:person="http://rdf.pozitron.com/people/" 
    xmlns:organization="http://rdf.pozitron.com/organizations/" 
    xml:base="http://example.org/" 
    xmlns:ex="http://example.org/#"> 
    <owl:ObjectProperty rdf:ID="employ"> 
    <rdf:type rdf:resource="http://rdf.pozitron.com/organizations/" /> 
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/organizations/"/> 
    <rdfs:range rdf:resource="http://rdf.pozitron.com/people/"/> 
    </owl:ObjectProperty> 
    <owl:ObjectProperty rdf:ID="employedBy"> 
    <rdf:type rdf:resource="http://rdf.pozitron.com/people/" /> 
    <owl:inverseOf rdf:resource="#Employ" /> 
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/people/"/> 
    <rdfs:range rdf:resource="http://rdf.pozitron.com/organizations/"/> 
    </owl:ObjectProperty> 
    <rdf:Description rdf:about="http://rdf.pozitron.com/people/john"> 
    <rdf:type rdf:resource="http://rdf.pozitron.com/people/"/> 
    <person:personName>John</person:personName> 
    <organization:organizationName>Pozitron</organization:organizationName> 
    </rdf:Description> 
</rdf:RDF> 

En tortue, c'est le suivant, et plusieurs problèmes sont révélés:

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 
@prefix ex:  <http://example.org/#> . 
@prefix person: <http://rdf.pozitron.com/people/> . 
@prefix organization: <http://rdf.pozitron.com/organizations/> . 
@prefix owl:  <http://www.w3.org/2002/07/owl#> . 
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 

ex:employedBy 
     a  person: , owl:ObjectProperty ; 
     rdfs:domain person: ; 
     rdfs:range organization: ; 
     owl:inverseOf ex:Employ . 

person:john 
     a  person: ; 
     organization:organizationName 
       "Pozitron" ; 
     person:personName "John" . 

ex:employ 
     a  owl:ObjectProperty , organization: ; 
     rdfs:domain organization: ; 
     rdfs:range person: . 

Les problèmes ici sont que:

  • l'inverse de » employedBy est Employ, mais il n'y a pas de propriété de ce nom, seulement employ;
  • la propriété employ est un organization
  • la propriété employedBy est un person
  • john a un organizationName
  • il n'y a pas d'organisation Pozitron.

Ils sont faciles à corriger dans cette syntaxe. Nous pouvons également ajouter les triplets john employedBy Pozitron et Pozitron employ john pendant que nous faisons cela. Nous nous retrouvons avec:

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 
@prefix ex:  <http://example.org/#> . 
@prefix person: <http://rdf.pozitron.com/people/> . 
@prefix organization: <http://rdf.pozitron.com/organizations/> . 
@prefix owl:  <http://www.w3.org/2002/07/owl#> . 
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 

ex:employedBy 
     a  owl:ObjectProperty ; 
     rdfs:domain person: ; 
     rdfs:range organization: ; 
     owl:inverseOf ex:employ . 

organization:Pozitron 
     a  organization: ; 
     organization:organizationName 
       "Pozitron" ; 
     ex:employ person:john . 

person:john 
     a  person: ; 
     person:personName "John" ; 
     ex:employedBy organization:Pozitron . 

ex:employ 
     a  owl:ObjectProperty ; 
     rdfs:domain organization: ; 
     rdfs:range person: . 

Nous pouvons voir à quoi cela ressemble dans RDF/XML trop en reconvertissant:

<rdf:RDF 
    xmlns:ex="http://example.org/#" 
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    xmlns:owl="http://www.w3.org/2002/07/owl#" 
    xmlns:person="http://rdf.pozitron.com/people/" 
    xmlns:organization="http://rdf.pozitron.com/organizations/" 
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > 
    <rdf:Description rdf:about="http://example.org/#employedBy"> 
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/> 
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/people/"/> 
    <rdfs:range rdf:resource="http://rdf.pozitron.com/organizations/"/> 
    <owl:inverseOf rdf:resource="http://example.org/#employ"/> 
    </rdf:Description> 
    <rdf:Description rdf:about="http://rdf.pozitron.com/organizations/Pozitron"> 
    <rdf:type rdf:resource="http://rdf.pozitron.com/organizations/"/> 
    <organization:organizationName>Pozitron</organization:organizationName> 
    <ex:employ rdf:resource="http://rdf.pozitron.com/people/john"/> 
    </rdf:Description> 
    <rdf:Description rdf:about="http://rdf.pozitron.com/people/john"> 
    <rdf:type rdf:resource="http://rdf.pozitron.com/people/"/> 
    <person:personName>John</person:personName> 
    <ex:employedBy rdf:resource="http://rdf.pozitron.com/organizations/Pozitron"/> 
    </rdf:Description> 
    <rdf:Description rdf:about="http://example.org/#employ"> 
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/> 
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/organizations/"/> 
    <rdfs:range rdf:resource="http://rdf.pozitron.com/people/"/> 
    </rdf:Description> 
</rdf:RDF> 

Si vous utilisez un raisonneur OWL qui peut gérer les propriétés inverses , vous n'avez vraiment pas besoin d'écrire à la fois john employedBy PozitronetPozitron employ john; vous pouvez en écrire un seul et le raisonneur déduira l'autre.

Questions connexes