W3C home > Mailing lists > Public > public-esw-thes@w3.org > April 2009

Re: Validating a SKOS document

From: Alistair Miles <alistair.miles@zoo.ox.ac.uk>
Date: Wed, 15 Apr 2009 19:27:25 +0100
To: Julien Sentier <juliensntr372@gmail.com>
Cc: public-esw-thes@w3.org
Message-ID: <20090415182722.GA11274@skiathos>
hi julien,

On Tue, Apr 14, 2009 at 04:02:50PM +0200, Julien Sentier wrote:
> Hi,
> 
> I'm completely new to Web Semantic stuff... I've started learning RDF,
> SKOS, etc. 3 days ago, so please don't shout at me :)

i wouldn't dream of it :)

> I'm trying to convert several thesauri into SKOS. Currently I'm trying
> to create by hand a valid SKOS file describing on particular term
> (Concept).
> 
> Enclosed, you will find a valid simple SKOS file and a non-valid file.
> The second file is not valid because I don't understand how to extend
> SKOS model. Right now, RDFS seems too complicated for me, and all
> examples I found are in Turtle...
> 
> For instance, I have declared a "copy" of skos:related named "viewAlso" :
>     <rdf:Property rdf:ID="viewAlso" rdfs:label="viewAlso">
>         <rdfs:subPropertyOf
> rdf:resource="http://www.w3.org/2004/02/skos/core#related"/>
>     </rdf:Property>
> 
> How to use it now ? As you can see I have put some ???:viewAlso
> because I don't know what to put instead of ???.
> 
> In fact I have another problem. In fact, the RDF validator does not
> like http://example.com/thesaurus/cis#. 

can you give the exact error report from the rdf validator? this uri
should not cause an rdf document to be invalid, there is no problem
with it.

> If I understand well, this URI
> should return a HTTP 200 code, isn't it ?

it is not necessary for any uri you use in an rdf document to
return any response code, or to return anything at all. it is
desirable, e.g. see [1], but not necessary.

further comments inline...

> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE rdf:RDF [
>     <!ENTITY cis 'http://example.com/thesaurus/cis#'>
>     <!ENTITY atc 'http://example.com/thesaurus/atc#'>
> ]>
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>     xmlns:skos="http://www.w3.org/2004/02/skos/core#"
>     xmlns:owl="http://www.w3.org/2002/07/owl#"
>     xmlns:dc="http://purl.org/dc/elements/1.1/"
>     xmlns:cis="&cis;">
> 
>     <skos:ConceptScheme rdf:about="http://example.com/thesaurus/cis/">
>         <dc:title xml:lang="fr">Terminologie cis</dc:title>
>         <dc:description xml:lang="fr">TODO</dc:description>
>         <dc:creator>John Doe</dc:creator>
>     </skos:ConceptScheme>
> 
>     <skos:ConceptScheme rdf:about="http://example.com/thesaurus/atc/">
>         <dc:title xml:lang="fr">Terminologie ATC</dc:title>
>         <dc:description xml:lang="fr">TODO</dc:description>
>     </skos:ConceptScheme>
> 
>     <skos:Concept rdf:about="&cis;CIS_MC_221">
>         <skos:prefLabel xml:lang="fr">asthme</skos:prefLabel>
>         <skos:prefLabel xml:lang="en">asthma</skos:prefLabel>
>         <skos:altLabel xml:lang="fr">Asthme bronchique</skos:altLabel>
>         <skos:altLabel xml:lang="en">asthma, bronchial</skos:altLabel>
>         <skos:altLabel xml:lang="en">asthmas</skos:altLabel>
>         <skos:altLabel xml:lang="en">asthmas, bronchial</skos:altLabel>
>         <skos:altLabel xml:lang="en">bronchial asthma</skos:altLabel>
>         <skos:altLabel xml:lang="en">bronchial asthmas</skos:altLabel>
>         <skos:inScheme rdf:resource="http://example.com/thesaurus/cis/"/>
> 
>         <skos:definition xml:lang="fr">Maladie caractérisée par une difficulté à respirer, se traduisant souvent par des sifflements. L'asthme, permanent ou survenant par crise, est dû à un spasme et à une inflammation des bronches.</skos:definition>
> 
>         <skos:broader rdf:resource="@cis;CIS_MC_84" />
>         <skos:broader rdf:resource="@cis;CIS_MC_276" />
>         <skos:broader rdf:resource="@cis;CIS_MC_6832" />
>         <skos:narrower rdf:resource="@cis;CIS_MC_8023" />
>         <skos:narrower rdf:resource="@cis;CIS_MC_18539" />

there is a problem here - you have @cis; in stead of &cis;

>         <!-- Other possibility: we have label and concept "ID" at the same time -->
>         <skos:broader>
>             <skos:Concept rdf:about="@cis;CIS_MC_XXXX">
>                 <skos:prefLabel>Concept name</skos:prefLabel>
>             </skos:Concept>
>         </skos:broader>
> 
>         <!-- This concept have a "brother" in ATC thesaurus
>         <skos:closeMatch rdf:resource="@atc;ATC_MC_YYY">
>         -->
>    </skos:Concept>
> </rdf:RDF>

> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE rdf:RDF [
>     <!ENTITY cis 'http://example.com/thesaurus/cis#'>
>     <!ENTITY atc 'http://example.com/thesaurus/atc#'>
> ]>
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>     xmlns:skos="http://www.w3.org/2004/02/skos/core#"
>     xmlns:owl="http://www.w3.org/2002/07/owl#"
>     xmlns:dc="http://purl.org/dc/elements/1.1/"
>     xmlns:cis="&cis;">
> 
>     <rdf:Property rdf:ID="viewAlso" rdfs:label="viewAlso">
>         <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2004/02/skos/core#related"/>        
>     </rdf:Property>

if you are going to use rdf:ID then your document needs to define a
URI base. you can do this by adding an xml:base attribute to the root
element.

you also need a uri namespace for your skos extensions. 

if you used something like
http://example.com/thesaurus/skos-extensions# as your namespace, then
you need to add

xml:base="http://example.com/thesaurus/skos-extensions"

to the root element of the document.

then the snippet above would translate to turtle as:

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema> .
@prefix skos: <http://www.w3.org/2004/02/skos/core> .
@prefix my: <http://example.com/thesaurus/skos-extensions#> .

my:viewAlso rdfs:subPropertyOf skos:related .

note that rdf:ID and rdf:about behave differently when it comes to
constructing a uri from the attribute value and the uri base. this is
one of the biggest gotchas when working in rdf/xml. generally, i tend
to avoid using rdf:ID, and get used to how rdf:about works only, it
saves me confusion.

> 
>     <rdf:Property rdf:ID="metaTerm" rdfs:label="metaTerm">
>         <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2004/02/skos/core#related"/>        
>     </rdf:Property>
> 
>     <rdf:Property rdf:ID="qualificatif" rdfs:label="qualificatif">
>         <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2004/02/skos/core#related"/>        
>     </rdf:Property>
> 
>     <rdf:Property rdf:ID="broaderTransitiveWithTree" rdfs:label="broaderTransitiveWithTree">
>         <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2004/02/skos/core#broaderTransitive"/>        
>     </rdf:Property>
> 
>     <skos:ConceptScheme rdf:about="http://example.com/thesaurus/cis/">
>         <dc:title xml:lang="fr">Terminologie cis</dc:title>
>         <dc:description xml:lang="fr">TODO</dc:description>
>         <dc:creator>John Doe</dc:creator>
>     </skos:ConceptScheme>
> 
>     <skos:ConceptScheme rdf:about="http://example.com/thesaurus/atc/">
>         <dc:title xml:lang="fr">Terminologie ATC</dc:title>
>         <dc:description xml:lang="fr">TODO</dc:description>
>     </skos:ConceptScheme>
> 
>     <skos:Concept rdf:about="&cis;CIS_MC_221">
>         <skos:prefLabel xml:lang="fr">asthme</skos:prefLabel>
>         <skos:prefLabel xml:lang="en">asthma</skos:prefLabel>
>         <skos:altLabel xml:lang="fr">Asthme bronchique</skos:altLabel>
>         <skos:altLabel xml:lang="en">asthma, bronchial</skos:altLabel>
>         <skos:altLabel xml:lang="en">asthmas</skos:altLabel>
>         <skos:altLabel xml:lang="en">asthmas, bronchial</skos:altLabel>
>         <skos:altLabel xml:lang="en">bronchial asthma</skos:altLabel>
>         <skos:altLabel xml:lang="en">bronchial asthmas</skos:altLabel>
>         <skos:inScheme rdf:resource="http://example.com/thesaurus/cis/"/>
> 
>         <skos:definition xml:lang="fr">Maladie caractérisée par une difficulté à respirer, se traduisant souvent par des sifflements. L'asthme, permanent ou survenant par crise, est dû à un spasme et à une inflammation des bronches.</skos:definition>
> 
>         <skos:broader rdf:resource="@cis;CIS_MC_84" />
>         <skos:broader rdf:resource="@cis;CIS_MC_276" />
>         <skos:broader rdf:resource="@cis;CIS_MC_6832" />
>         <skos:narrower rdf:resource="@cis;CIS_MC_8023" />
>         <skos:narrower rdf:resource="@cis;CIS_MC_18539" />
> 
>         <!-- Other possibility: we have label and concept "ID" at the same time -->
>         <skos:broader>
>             <skos:Concept rdf:about="@cis;CIS_MC_XXXX">
>                 <skos:prefLabel>Concept name</skos:prefLabel>
>             </skos:Concept>
>         </skos:broader>
> 
>         <!-- This concept have a "brother" in ATC thesaurus
>         <skos:closeMatch rdf:resource="@atc;ATC_MC_YYY">
>         -->
> 
>         <???:viewAlso rdf:resource="@cis;CIS_MC_3938"/>
>         <???:viewAlso rdf:resource="@cis;CIS_MC_12933"/>
> 
>         <???:metaTerm rdf:resource="@cis;CIS_MT_XXX"/> <!-- demander où trouver cette relation (tb_descripteur_relation?) -->
>         <???:qualifacatif rdf:resource="@cis;CIS_QU_10"/> <!-- demander où trouver cette relation (tb_descripteur_relation?) -->
>         <!-- demander où trouver les infos présentes dans la frame de gauche (mots-clés mesh, action pharmacologique, autre ? -->
> 

here you need to declare a namespace prefix for the namespace you use
for your skos extensions, just like you delcare a namespace prefix for
skos or rdf.

e.g. if you add

xmlns:my="http://example.com/thesaurus/skos-extensions#" 

to the root element of the document, then you could do

>         <my:viewAlso rdf:resource="@cis;CIS_MC_3938"/>
>         <my:viewAlso rdf:resource="@cis;CIS_MC_12933"/>
> 
>         <my:metaTerm rdf:resource="@cis;CIS_MT_XXX"/> <!-- demander où trouver cette relation (tb_descripteur_relation?) -->
>         <my:qualifacatif rdf:resource="@cis;CIS_QU_10"/> <!-- demander où trouver cette relation (tb_descripteur_relation?) -->

hope that helps,

alistair

-- 
Alistair Miles
Senior Computing Officer
Image Bioinformatics Research Group
Department of Zoology
The Tinbergen Building
University of Oxford
South Parks Road
Oxford
OX1 3PS
United Kingdom
Web: http://purl.org/net/aliman
Email: alistair.miles@zoo.ox.ac.uk
Tel: +44 (0)1865 281993
Received on Wednesday, 15 April 2009 18:28:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:45:55 UTC