I have a RDF file that contains resources with rdfs:label already assigned to them. What I am trying to achieve is to add additional skos:prefLabel for every rdfs:label instance in the document.

I was trying to use CONSTRUCT to do it, but the rdfs:label get replaced by skos:prefLabel, which is wrong because I want to add the skos:prefLabel in addition to the existing rdfs:label.

Hopefully someone can help on this.

Thanks.


I am using TopBraid Composer, And please bear with me I am noob in SPARQL and all the semantic web technologies.

I was trying to make the below query work:

CONSTRUCT { 
    ?c a rdfs:label .
    ?c skos:prefLabel ?pl . 
} 
WHERE { 
    ?c rdfs:subClassOf ?superclass . 
    BIND(skos:prefLabel as ?pl) . 
}

asked 05 Nov '12, 10:35

OntoLearner's gravatar image

OntoLearner
6217
accept rate: 0%

edited 05 Nov '12, 16:50

Signified's gravatar image

Signified ♦
24.0k1623

2

CONSTRUCT is the way to go. Please show us the query you have and possibly we will be able to make it work right for you.

(05 Nov '12, 12:36) Tomasz Plusk... Tomasz%20Pluskiewicz's gravatar image
2

In addition, also let us know which tool you use to execute the CONSTRUCT query and modify the file.

(05 Nov '12, 15:13) Jeen Broekstra ♦ Jeen%20Broekstra's gravatar image

I am using TopBraid Composer, And please bear with me I am noob in SPARQL and all the semantic web technologies.

I was trying to make the below query work:

CONSTRUCT { ?c a rdfs:label .
?c skos:prefLabel ?pl . } WHERE { ?c rdfs:subClassOf ?superclass . BIND(skos:prefLabel as ?pl) . }

(05 Nov '12, 16:26) OntoLearner OntoLearner's gravatar image

I have submitted an answer but please post a sample of you file because I think I might be on a wrong track here.

(05 Nov '12, 16:45) Tomasz Plusk... Tomasz%20Pluskiewicz's gravatar image

First, it seems that you have the concepts mixed up a little. It looks like you are trying to change types fo your labels. For one thing, rdfs:label is a property and not a class so placing it as object next to rdf:type (which a stands for) makes little sense. Other than that you don't reference the actual labelled resources in your WHERE graph pattern as I have expected to see.

From your description I understand that you want to find all resources labelled with rdfs:label and add similar triples with skos:prefLabel instead. Provided that your file contains triples like

ex:someResource rdfs:label "the label"

You should be using a CONSTRUCT like

CONSTRUCT
{
   ?res skos:prefLabel ?label
}
WHERE
{
   ?res rdfs:label ?label
}

and then combine the resulting graph with what you already have.

permanent link

answered 05 Nov '12, 16:44

Tomasz%20Pluskiewicz's gravatar image

Tomasz Plusk...
1.4k19
accept rate: 30%

edited 06 Nov '12, 01:15

1

I don't use TBC, and I may be completeyl wrong, but if SKOS is imported will it infer that all skos:prefLabel s are rdfs:label s (as rdfs:label is a super property of skos:prefLabel - http://www.w3.org/2009/08/skos-reference/skos.html#prefLabel)?

Also check out @scotthenniger 's response here - http://answers.semanticweb.com/questions/11115/rdfslabel-vs-skospreflabel-vs-dctitle

(05 Nov '12, 17:10) Sweet Burlap Sweet%20Burlap's gravatar image

@Tomasz, there is an extra ? before the rdfs:label in your query.

(06 Nov '12, 00:01) Holger Knubl... Holger%20Knublauch's gravatar image

@Holger Thanks, I have fixed that.

(06 Nov '12, 03:47) Tomasz Plusk... Tomasz%20Pluskiewicz's gravatar image

Thanks so much Tomasz,

Your suggestion helped me to do what I was looking for with the following query:

CONSTRUCT
{
    ?res skos:prefLabel ?label .
    ?c rdfs:label ?label .
}
WHERE
{
   ?res rdfs:label ?label .
   ?c rdfs:label ?label .
}
permanent link

answered 06 Nov '12, 14:48

OntoLearner's gravatar image

OntoLearner
6217
accept rate: 0%

4

That is precisely the same as:

CONSTRUCT
{
    ?c skos:prefLabel ?label .
    ?c rdfs:label ?label .
}
WHERE
{
    ?c rdfs:label ?label .
}

Except this query will probably be faster.

(06 Nov '12, 15:08) Signified ♦ Signified's gravatar image

Thanks for the suggestion Signified.

(07 Nov '12, 09:16) OntoLearner OntoLearner's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,297
×32
×17
×6

question asked: 05 Nov '12, 10:35

question was seen: 1,080 times

last updated: 07 Nov '12, 09:16