Reputation: 105
For example, how to use SPARQL query to get the zthes:label in Def1-4393574 for the skos:Concept (#4393574). Thanks!
<?xml version="1.0" encoding="UTF-8"?>
<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:zthes="http://synaptica.net/zthes/">
<skos:Concept rdf:about="#4393574">
<skos:prefLabel>A prefLabel</skos:prefLabel>
<zthes:termNote rdf:ID="Def1-4393574">Def1</zthes:termNote>
</skos:Concept>
<rdf:Description rdf:about="Def1-4393574">
<zthes:label> a zthes label</zthes:label>
</rdf:Description>
</rdf:RDF>
UPDATED: Here is the Turtle version converted by http://www.easyrdf.org/converter
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix ns0: <http://synaptica.net/zthes/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://example.me/#4393574>
a skos:Concept ;
skos:prefLabel "A prefLabel" ;
ns0:termNote "Def1" .
<http://example.me/#Def1-4393574>
a rdf:Statement ;
rdf:subject <http://example.me/#4393574> ;
rdf:predicate ns0:termNote ;
rdf:object "Def1" .
<http://example.me/Def1-4393574> ns0:label " a zthes label" .
Upvotes: 0
Views: 311
Reputation: 22042
The problem is that your data doesn't actually have a relation between the zthes:label and the skos:Concept.
The root cause of this is a subtle syntax error in your original RDF/XML file. This line:
<zthes:termNote rdf:ID="Def1-4393574">Def1</zthes:termNote>
defines a resource with identifier <http://example.me/#Def1-4393574>
. Meanwhile, this line:
<rdf:Description rdf:about="Def1-4393574">
defines another resource, with identifier <http://example.me/Def1-4393574>
. They are not the same resource (notice the missing #
), so the two definitions are not linked. This particular problem could be fixed by adding a #
in front, like so:
<rdf:Description rdf:about="#Def1-4393574">
This fix would result in the following RDF model (using Turtle syntax):
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix zthes: <http://synaptica.net/zthes/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://example.me/#4393574>
a skos:Concept ;
skos:prefLabel "A prefLabel" ;
zthes:termNote "Def1" .
<http://example.me/#Def1-4393574>
a rdf:Statement ;
rdf:subject <http://example.me/#4393574> ;
rdf:predicate ns0:termNote ;
rdf:object "Def1";
zthes:label " a zthes label" .
It's still a very odd RDF model by the way, using statement reification, but assuming that this is just what you have to work with, a query to get the zthes label for given concept would be something like this:
PREFIX zthes: <http://synaptica.net/zthes/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?label
WHERE {
[] rdf:subject <http://example.me/#4393574> ;
zthes:label ?label .
}
Upvotes: 1