The Sixteen Faces of Eve

RDF/XML w praktyce

Michał Świątkiewicz

2005.11.15

http://purl.org/net/mimas/semweb/

The Sixteen Faces of Eve

Prosty przykład opublikowany na blogu Internet Alchemy — osoba, o imieniu Eve i stronie domowej <http://example.org/~eve>.

Opis w N3:

@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

_:eve rdf:type foaf:Person .
_:eve foaf:name "Eve" .
_:eve foaf:homepage <http://example.org/~eve> .

Następnie podano 16 różnych, poprawnych wersji zapisu tej informacji w formacie RDF/XML. Ta liczba nie wyczerpuje wszystkich możliwości.

#1

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <foaf:Person>
    <foaf:name>Eve</foaf:name>
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </foaf:Person>
</rdf:RDF>

#2

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description>
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
    <foaf:name>Eve</foaf:name>
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#3

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <foaf:Person foaf:name="Eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </foaf:Person>
</rdf:RDF>

#4

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description foaf:name="Eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#5

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <foaf:Person rdf:nodeID="eve">
    <foaf:name>Eve</foaf:name>
  </foaf:Person>
  <rdf:Description rdf:nodeID="eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#6

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <foaf:Person rdf:nodeID="eve" foaf:name="Eve" />
  <rdf:Description rdf:nodeID="eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#7

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
    <foaf:name>Eve</foaf:name>
  </rdf:Description>
  <rdf:Description rdf:nodeID="eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#8

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve" foaf:name="Eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
  </rdf:Description>
  <rdf:Description rdf:nodeID="eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#9

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve">
    <foaf:name>Eve</foaf:name>
  </rdf:Description>
  <foaf:Person rdf:nodeID="eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </foaf:Person>
</rdf:RDF>

#10

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve" foaf:name="Eve" />
  <foaf:Person rdf:nodeID="eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </foaf:Person>
</rdf:RDF>

#11

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve">
    <foaf:name>Eve</foaf:name>
  </rdf:Description>
  <rdf:Description rdf:nodeID="eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#12

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve" foaf:name="Eve" />
  <rdf:Description rdf:nodeID="eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#13

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
  </rdf:Description>
  <rdf:Description rdf:nodeID="eve">
    <foaf:name>Eve</foaf:name>
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#14

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
  </rdf:Description>
  <rdf:Description rdf:nodeID="eve" foaf:name="Eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
</rdf:RDF>

#15

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve">
    <foaf:name>Eve</foaf:name>
  </rdf:Description>
  <rdf:Description rdf:nodeID="eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
  <rdf:Description rdf:nodeID="eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
  </rdf:Description>
</rdf:RDF>

#16

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:foaf="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:nodeID="eve" foaf:name="Eve" />
  <rdf:Description rdf:nodeID="eve">
    <foaf:homepage rdf:resource="http://example.org/~eve"/>
  </rdf:Description>
  <rdf:Description rdf:nodeID="eve">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
  </rdf:Description>
</rdf:RDF>

...i to jeszcze nie koniec

Możliwe dalsze zmiany:

W efekcie: 30 poprawnych wersji RDF/XML dla grafu RDF składającego się zaledwie z 3 wyrażeń (trójek).

 

Powyższa mnogość wersji powoduje bardzo poważne utrudnienia w stosowaniu do plików RDF/XML standardowych mechanizmów obsługi plików XML, np. wybór wartości przez XPath, transformacja przez XSLT itp.