Last updated: $Date: 2005/05/05 14:46:20 $
This document contains a set of test cases to be used when evaluating existing and new proposals for mapping RDF data to Topic Maps and vice versa. It consists of two sections covering Topic Maps examples and RDF examples respectively. The goal of this document is to provide a complete set of test cases that illustrates every aspect of both models. A limited subset of simple test cases, intended to form the principal basis for illustrating differences between existing proposals, is indicated by an asterisk ( * ) in the name.
@@Need to look at the official RDF test cases and see if they are suitable for our purpose. AP for Nicola Gessa.
The following examples are used in the DraftSurvey in order to evaluate the fidelity of existing proposals (see the DraftSurvey for a definition of fidelity).
[puccini : composer = "Giacomo Puccini" @"http://en.wikipedia.org/wiki/Puccini"] [tosca : opera = "Tosca" @"http://psi.ontopia.net/opera/#tosca"] {tosca, premiere-date, [ [1900-01-14]]} {tosca, synopsis, "http://www.azopera.com/learn/synopsis/tosca.shtml"} composed-by( tosca : opera, puccini : composer ) [composer = "Composer" @"http://psi.ontopia.net/music/#composer"] [opera = "Opera" @"http://psi.ontopia.net/music/#opera"] [premiere-date = "Première date" @"http://psi.ontopia.net/opera/#premiere-date"] [synopsis = "Synopsis" @"http://psi.ontopia.net/opera/#synopsis"] [composed-by = "Composed by" @"http://psi.ontopia.net/music/#composed-by"]
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <topicMap xmlns="http://www.topicmaps.org/xtm/1.0/" xmlns:xlink="http://www.w3.org/1999/xlink"> <topic id="opera"> <subjectIdentity> <subjectIndicatorRef xlink:href="http://psi.ontopia.net/music/#opera"></subjectIndicatorRef> </subjectIdentity> <baseName> <baseNameString>Opera</baseNameString> </baseName> </topic> <topic id="composer"> <subjectIdentity> <subjectIndicatorRef xlink:href="http://psi.ontopia.net/music/#composer"></subjectIndicatorRef> </subjectIdentity> <baseName> <baseNameString>Composer</baseNameString> </baseName> </topic> <topic id="premiere-date"> <subjectIdentity> <subjectIndicatorRef xlink:href="http://psi.ontopia.net/opera/#premiere-date"></subjectIndicatorRef> </subjectIdentity> <baseName> <baseNameString>Première date</baseNameString> </baseName> </topic> <topic id="composed-by"> <subjectIdentity> <subjectIndicatorRef xlink:href="http://psi.ontopia.net/music/#composed-by"></subjectIndicatorRef> </subjectIdentity> <baseName> <baseNameString>Composed by</baseNameString> </baseName> </topic> <topic id="puccini"> <instanceOf> <topicRef xlink:href="#composer"></topicRef> </instanceOf> <subjectIdentity> <subjectIndicatorRef xlink:href="http://en.wikipedia.org/wiki/Puccini"></subjectIndicatorRef> </subjectIdentity> <baseName> <baseNameString>Giacomo Puccini</baseNameString> </baseName> </topic> <topic id="tosca"> <instanceOf> <topicRef xlink:href="#opera"></topicRef> </instanceOf> <subjectIdentity> <subjectIndicatorRef xlink:href="http://psi.ontopia.net/opera/#tosca"></subjectIndicatorRef> </subjectIdentity> <baseName> <baseNameString>Tosca</baseNameString> </baseName> <occurrence> <instanceOf> <topicRef xlink:href="#premiere-date"></topicRef> </instanceOf> <resourceData>1900 (14 Jan)</resourceData> </occurrence> <occurrence> <instanceOf> <topicRef xlink:href="#synopsis"></topicRef> </instanceOf> <resourceRef xlink:href="http://www.azopera.com/learn/synopsis/tosca.shtml"></resourceRef> </occurrence> </topic> <topic id="synopsis"> <subjectIdentity> <subjectIndicatorRef xlink:href="http://psi.ontopia.net/opera/#synopsis"></subjectIndicatorRef> </subjectIdentity> <baseName> <baseNameString>Synopsis</baseNameString> </baseName> </topic> <association> <instanceOf> <topicRef xlink:href="#composed-by"></topicRef> </instanceOf> <member> <roleSpec> <topicRef xlink:href="#composer"></topicRef> </roleSpec> <topicRef xlink:href="#puccini"></topicRef> </member> <member> <roleSpec> <topicRef xlink:href="#opera"></topicRef> </roleSpec> <topicRef xlink:href="#tosca"></topicRef> </member> </association> </topicMap>
@prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix ev: <http://ebiquity.umbc.edu/v2.1/ontology/event.owl#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . @prefix music: <http://www.kanzaki.com/ns/music#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . [ rdf:type music:Concert; dc:title "Tokyo Green Symphony Orchestra 12th Concert"; dc:date "2003-11-02T14:00+09:00"; ev:location [ rdf:type music:Venue; dc:title "Sumida Triphony"; geo:lat "35.69"; geo:long "139.81" ]; music:conductor [ rdf:type music:Conductor; foaf:name "Yuri Nitta" ]; music:performer [ rdf:type music:Violinist; foaf:name "Tomoko Kawada" ] ] . music:Concert rdfs:label "Concert" . music:Conductor rdfs:label "Conductor" . music:Venue rdfs:label "Venue" . music:Violinist rdfs:label "Violinist" . music:conductor rdfs:label "Conductor" . music:performer rdfs:label "Performer" . dc:date rdfs:label "Date" . dc:title rdfs:label "Title" . ev:location rdfs:label "Event Location" . foaf:name rdfs:label "Name" . geo:lat rdfs:label "Latitude" . geo:long rdfs:label "Longitude" .
This section contains test cases for evaluating mappings from Topic Maps to RDF according to criteria defined by the RDF/Topic Maps Interoperability Task Force of the Semantic Web Best Practices and Deployment Working Group.
For the sake of brevity, the examples are shown here in LTM syntax where possible. Where LTM does not support a particular construct (e.g. reified associations), XTM syntax is used instead.
The terms 'identifier' and 'name' are used to mean 'subject identifier' and 'base name' respectively.
NOTE: Some of these examples require "additional information" in order to be easily interpreted by a human, e.g. the name and identifier of the typing topic in 1.2. Such additional information is separated from the basic example by an LTM comment (/* +++ */) and may be omitted when showing the results of data transformations.
[puccini = "Giacomo Puccini"]
[puccini = "Giacomo Puccini" @"http://en.wikipedia.org/wiki/Puccini"]
[puccini : composer = "Giacomo Puccini" @"http://en.wikipedia.org/wiki/Puccini"] /* +++ */ [composer = "Composer" @"http://psi.ontopia.net/music/#composer"]
[puccini = "Giacomo Puccini" = "Puccini" /shortname @"http://en.wikipedia.org/wiki/Puccini"] /* +++ */ [shortname = "Short name" @"http://psi.ontopia.net/basename/#short-name"]
[composer = "Composer" = "Komponist" / nor = "Säveltäjä" / fin @"http://psi.ontopia.net/music/#composer"] /* +++ */ [nor = "Norwegian" @"http://psi.oasis-open.org/iso/639/#nor"] [fin = "Finnish" @"http://psi.oasis-open.org/iso/639/#fin"]
[no = "Norwegian" @"http://psi.oasis-open.org/iso/639/#nor" @"http://www.topicmaps.org/xtm/1.0/language.xtm#no"]
[boito : composer librettist = "Arrigo Boïto" @"http://en.wikipedia.org/wiki/Boito"] /* +++ */ [composer = "Composer" @"http://psi.ontopia.net/music/#composer"] [librettist = "Librettist" @"http://psi.ontopia.net/opera/#librettist"]
[@@Opening delimiter for internal occurrence modified because of conflict with Wiki syntax. Fix before publishing.
[tosca = "Tosca" @"http://psi.ontopia.net/opera/#tosca"] {tosca, premiere-date, [ [1900-01-14]]} /* +++ */ [premiere-date = "Première date" @"http://psi.ontopia.net/opera/#premiere-date"]
[tosca = "Tosca" @"http://psi.ontopia.net/opera/#tosca"] {tosca, synopsis, "http://www.azopera.com/learn/synopsis/tosca.shtml"} /* +++ */ [synopsis = "Synopsis" @"http://psi.ontopia.net/opera/#synopsis"]
[puccini = "Giacomo Puccini" @"http://en.wikipedia.org/wiki/Puccini"] [tosca = "Tosca" @"http://psi.ontopia.net/opera/#tosca"] composed-by( tosca : opera, puccini : composer ) /* +++ */ [composer = "Composer" @"http://psi.ontopia.net/music/#composer"] [opera = "Opera" @"http://psi.ontopia.net/music/#opera"] [composed-by = "Composed by" @"http://psi.ontopia.net/music/#composed-by"]
[turandot = "Turandot" @"http://psi.ontopia.net/opera/#turandot"] unfinished( turandot : work ) /* +++ */ [unfinished = "Unfinished" @"http://psi.ontopia.net/xtm/association-type/unfinished"] [work = "Work" @"http://psi.ontopia.net/literature/#work"]
[scarpia = "Baron Scarpia" @"http://psi.ontopia.net/opera/tosca/#scarpia"] [tosca-c = "Tosca" @"http://psi.ontopia.net/opera/tosca/#floria-tosca"] [stabbing = "Stabbing" @"http://psi.ontopia.net/opera/cause-of-death/#stabbing"] killed-by( scarpia : victim, tosca-c : perpetrator, stabbing : cause-of-death ) /* +++ */ [victim = "Victim" @"http://psi.ontopia.net/biography/#victim"] [perpetrator = "Perpetrator" @"http://psi.ontopia.net/biography/#perpetrator"] [cause-of-death = "Cause of death" @"http://psi.ontopia.net/biography/#cause-of-death"]
The character Rodolfo is a tenor in the context of Puccini's La Bohème and a baritone in the context of Catalani's La Bohème. [@@Example not complete]]
<association> <instanceOf><topicRef xlink:href="#has-voice"/></instanceOf> <scope><topicRef xlink:href="#la-boheme"/></scope> <member> <roleSpec><topicRef xlink:href="#character"/></roleSpec> <topicRef xlink:href="#rodolfo"/> </member> <member> <roleSpec><topicRef xlink:href="#voice-type"/></roleSpec> <topicRef xlink:href="#tenor"/> </member> </association> <!-- +++ --> <association> <instanceOf><topicRef xlink:href="#has-voice"/></instanceOf> <scope><topicRef xlink:href="#la-boheme2"/></scope> <member> <roleSpec><topicRef xlink:href="#character"/></roleSpec> <topicRef xlink:href="#rodolfo"/> </member> <member> <roleSpec><topicRef xlink:href="#voice-type"/></roleSpec> <topicRef xlink:href="#baritone"/> </member> </association>
The assertion that Isabeau was premiered on June 2nd 1911 is made by mascagni.org. [@@Example not complete]]
<topic id="isabeau"> <baseName> <baseNameString>Isabeau</baseNameString> </baseName> <occurrence> <instanceOf><topicRef xlink:href="#premiere-date"/></instanceOf> <scope><topicRef xlink:href="#mascagni.org"/></scope> <resourceData>1911-06-02</resourceData> </occurrence> </topic>
<association id="a-tosca-takes-place-in">
<instanceOf>
<topicRef xlink:href="opera-template.xtmp#takes-place-in"/>
</instanceOf>
<scope>
<topicRef xlink:href="ontopsi.xtmm#music"/>
<topicRef xlink:href="ontopsi.xtmm#geography"/>
</scope>
<member>
<roleSpec>
<topicRef xlink:href="opera-template.xtmp#opera"/>
</roleSpec>
<topicRef xlink:href="#tosca"/>
</member>
<member>
<roleSpec>
<topicRef xlink:href="geography.xtmm#place"/>
</roleSpec>
<topicRef xlink:href="geography.xtmm#roma"/>
</member>
</association>
<!-- reified association -->
<topic id="tosca-takes-place-in">
<subjectIdentity>
<subjectIndicatorRef xlink:href="#a-tosca-takes-place-in"/>
</subjectIdentity>
<baseName>
<baseNameString>The setting of Tosca in Rome</baseNameString>
</baseName>
</topic>
<association>
<instanceOf>
<topicRef xlink:href="opera-template.xtmp#killed-by"/>
</instanceOf>
<scope>
<topicRef xlink:href="ontopsi.xtmm#music"/>
</scope>
<member>
<roleSpec id="victim-in-tosca-killed-by-tosca">
<topicRef xlink:href="opera-template.xtmp#victim"/>
</roleSpec>
<topicRef xlink:href="#scarpia"/>
</member>
<member>
<roleSpec>
<topicRef xlink:href="opera-template.xtmp#perpetrator"/>
</roleSpec>
<topicRef xlink:href="#tosca-c"/>
</member>
<member>
<roleSpec>
<topicRef xlink:href="opera-template.xtmp#cause-of-death"/>
</roleSpec>
<topicRef xlink:href="#stabbing"/>
</member>
</association>
<!-- reified association role -->
<topic id="the-victim-in-tosca-killed-by-tosca">
<subjectIdentity>
<subjectIndicatorRef xlink:href="#victim-in-tosca-killed-by-tosca"/>
</subjectIdentity>
<baseName>
<baseNameString>Victim in Tosca killed by Tosca</baseNameString>
</baseName>
</topic>
<topic id="isabeau">
<baseName>
<baseNameString>Isabeau</baseNameString>
</baseName>
<occurrence id="isabeau-premiere-date">
<instanceOf>
<topicRef xlink:href="#premiere-date"/>
</instanceOf>
<scope>
<topicRef xlink:href="#mascagni.org"/>
</scope>
</occurrence>
</topic>
<!-- reified occurrence -->
<topic id="the-isabeau-premiere-date">
<subjectIdentity>
<subjectIndicatorRef xlink:href="#isabeau-premiere-date"/>
</subjectIdentity>
<baseName>
<baseNameString>Premiere date for Isabeau</baseNameString>
</baseName>
</topic>
@@@TBD
[libretto = "Libretto"] [toscaLibretto:libretto %"http://www.azopera.com/learn/synopsis/toscaLibretto.shtml"]
The name of the topic "Libretto" has a variant ("Libretti") for use in processing contexts where the plural form is required. [@@Example not complete]]
<topic id="libretto"> <baseName> <baseNameString>Libretto</baseNameString> <variant> <parameters> <subjectIndicatorRef xlink:href="http://psi.ontopia.net/xtm/basename/plural"/> </parameters> <variantName><resourceData>Libretti</resourceData></variantName> </variant> </baseName> </topic>
@@TBD
[libretto = "Libretto"] [toscaLibretto:libretto %"http://www.azopera.com/learn/synopsis/toscaLibretto.shtml" @"http://psi.ontopia.net/opera/#toscaLibretto" ]
A statement whose object is a URIref. [@@SP: This is an example that would most naturally be translated to an external occurrence. Should we add a second example that would be more naturally translated to an association?]
<http://www.w3.org/People/EM/contact#me> <http://www.w3.org/2000/10/swap/pim/contact#mailbox> <mailto:em@w3.org> .
A statement whose property is rdf:type.
<http://www.w3.org/People/EM/contact#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/10/swap/pim/contact#Person> .
A statement whose object is a plain literal.
<http://www.w3.org/People/EM/contact#me> <http://www.w3.org/2000/10/swap/pim/contact#fullName> "Eric Miller" .
A statement whose object is a typed literal. (@@SP: Use EMs birth date?)
<http://www.example.org/staffid/85740> <http://www.example.org/terms/age> "27"^^<http://www.w3.org/2001/XMLSchema#integer> .
A statement whose object is of type XMLLiteral. (@@SP: Need to check if N3 can be used for this.)
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:base="http://www.example.com/books"> <rdf:Description rdf:ID="book12345"> <dc:title rdf:parseType="Literal"> The <em><br /></em> Element Considered Harmful. </dc:title> </rdf:Description> </rdf:RDF>
A statement whose property has an xml:lang attribute. (@@SP: Can N3 express this?)
<dc:coverage> <pcv:Descriptor rdf:about="http://prismstandard.org/vocabs/ISO-3166/GR"> <pcv:label xml:lang="en">Greece</pcv:label> <pcv:label xml:lang="fr">Grèce</pcv:label> </pcv:Descriptor> </dc:coverage>
A graph containing a blank node.
@prefix exstaff: <http://www.example.org/staff/> . @prefix exterms: <http://www.example.org/terms/> . exstaff:85740 exterms:address _:johnaddress . _:johnaddress exterms:street "1501 Grant Avenue" . _:johnaddress exterms:city "Bedford" . _:johnaddress exterms:state "Massachusetts" . _:johnaddress exterms:postalCode "01730" .
A statement that uses rdf:value.
<?xml version="1.0"?> <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:exterms="http://www.example.org/terms/"> <rdf:Description rdf:about="http://www.example.com/2002/04/products#item10245"> <exterms:weight rdf:parseType="Resource"> <rdf:value rdf:datatype="&xsd;decimal">2.4</rdf:value> <exterms:units rdf:resource="http://www.example.org/units/kilograms"/> </exterms:weight> </rdf:Description> </rdf:RDF> ---------------------- N3 equivalent ------------------------------------- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix exterms: <http://www.example.org/terms/> . @prefix exprods: <http://www.example.org/products#> . exprods:item10245 exterms:weight _:weight10245 . _:weight10245 rdf:value "2.4"^^xsd:decimal . _:weight10245 exterms:units exunits:kilograms .
An example of a Bag. (@@SP: Use RDF/XML or N3 example?)
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/students/vocab#"> <rdf:Description rdf:about="http://example.org/courses/6.001"> <s:students> <rdf:Bag> <rdf:li rdf:resource="http://example.org/students/Amy"/> <rdf:li rdf:resource="http://example.org/students/Mohamed"/> <rdf:li rdf:resource="http://example.org/students/Johann"/> <rdf:li rdf:resource="http://example.org/students/Maria"/> <rdf:li rdf:resource="http://example.org/students/Phuong"/> </rdf:Bag> </s:students> </rdf:Description> </rdf:RDF> ---------------------- N3 example (from RDF Primer) ---------------------- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://www.example.org/> . @prefix exterms: <http://www.example.org/terms/> . ex:resolution exterms:approvedBy ex:rulesCommittee . ex:rulesCommittee rdf:type rdf:Bag . ex:rulesCommittee rdf:_1 ex:Fred . ex:rulesCommittee rdf:_2 ex:Wilma . ex:rulesCommittee rdf:_3 ex:Dino .
An example of a Sequence. (@@SP: Use N3 instead?)
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/students/vocab#"> <rdf:Description rdf:about="http://example.org/courses/6.001"> <s:students> <rdf:Seq> <rdf:li rdf:resource="http://example.org/students/Amy"/> <rdf:li rdf:resource="http://example.org/students/Mohamed"/> <rdf:li rdf:resource="http://example.org/students/Johann"/> <rdf:li rdf:resource="http://example.org/students/Maria"/> <rdf:li rdf:resource="http://example.org/students/Phuong"/> </rdf:Seq> </s:students> </rdf:Description> </rdf:RDF>
An example of an Alternative. (@@SP: Use N3 instead?)
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/packages/vocab#"> <rdf:Description rdf:about="http://example.org/packages/X11"> <s:DistributionSite> <rdf:Alt> <rdf:li rdf:resource="ftp://ftp.example.org"/> <rdf:li rdf:resource="ftp://ftp1.example.org"/> <rdf:li rdf:resource="ftp://ftp2.example.org"/> </rdf:Alt> </s:DistributionSite> </rdf:Description> </rdf:RDF>
An example of a Collection (List). (@@SP: Use N3 instead?)
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/students/vocab#"> <rdf:Description rdf:about="http://example.org/courses/6.001"> <s:students rdf:parseType="Collection"> <rdf:Description rdf:about="http://example.org/students/Amy"/> <rdf:Description rdf:about="http://example.org/students/Mohamed"/> <rdf:Description rdf:about="http://example.org/students/Johann"/> </s:students> </rdf:Description> </rdf:RDF>
An example of RDF Reification as described in [RDF Primer].
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix exterms: <http://www.example.org/terms/> . @prefix exprods: <http://www.example.org/products/> . # original statement exprods:item10245 exterms:weight "2.4"^^xsd:decimal . # reification quad exprods:triple12345 rdf:type rdf:Statement . exprods:triple12345 rdf:subject exprods:item10245 . exprods:triple12345 rdf:predicate exterms:weight . exprods:triple12345 rdf:object "2.4"^^xsd:decimal . # statement of provenance exprods:triple12345 dc:creator exstaff:85740 .
@@any other rdf: classes or properties?
@@rdfs: classes and predicates?
@@@TBD
Last updated $Date: 2005/05/05 14:46:20 $ by $Author: NicolaGessa? $