I have the following script which I used to convert my spreadsheet to RDF using SPARQL. It is working fine for my initial purpose, but I would like to modify it a little bit so that it creates rdfs:label and skos:prefLabel for every class. I got from the TopBraid discussion group by Bob DuCharme.

    ?newClass a owl:Class .
    ?newClass rdfs:subClassOf ?superClass .
    ?newLabel rdfs:label ?label .
    ?newLabel skos:prefLabel ?label .
    ?c a ss:Cell .
    ?c ss:row ?row .
    ?c ss:column ?col .
    ?c ss:cellContents ?contents .
    FILTER (?row > 0) .
    BIND ((?col - 1) AS ?parentCol) .
        ?parent ss:row ?row .
        ?parent ss:column ?parentCol .
        ?parent ss:cellContents ?parentContents .
    } .
    BIND (IRI(fn:concat("http://www.mysample.com/", ?contents)) AS ?newClass) .
    BIND (IRI(fn:concat("http://www.mysample.com/", ?parentContents)) AS ?superClass) .

asked 15 Nov '12, 17:03

OntoLearner's gravatar image

accept rate: 0%

What is your question?

(15 Nov '12, 17:48) AndyS ♦ AndyS's gravatar image

I presume the 4th and 5th are your additional lines. Presumably we are linking the label to the ?newClass, so I have changed the ?newLabel to the ?newClass. The cell contents probably make to best sense as a label so I have used that as a value. Try:

    ?newClass a owl:Class .
    ?newClass rdfs:subClassOf ?superClass .
    ?newClass rdfs:label ?contents .
    ?newClass skos:prefLabel ?contents .

Does it work as you had expected?

permanent link

answered 16 Nov '12, 05:26

Sweet%20Burlap's gravatar image

Sweet Burlap
accept rate: 19%


Thanks Sweet Burlap,

It is now working as I had expected.

(16 Nov '12, 08:49) OntoLearner OntoLearner's gravatar image

Hello again,

Is it possible to create a placeholder and assign its value to a skos:altLabel, which does not exist yet in the spreadsheet I am converting. Following is my scenario: My spreadsheet will be updated with the alternate label content. I would like to plan for that inclusion in my script. So I am thinking to add something like ?c placeholder ?altcontent .

My CONSTRUCT will look like: CONSTRUCT {... ?newClass skos:altLabel ?altcontent . } Then the... WHERE { ... ?c placeholder ?altcontent . }

(16 Nov '12, 11:13) OntoLearner OntoLearner's gravatar image

you could decide where your altLabel are going to be in your spreadsheet (but are currently blank) and write the SPARQL to acccomodate that.

I think you might have a big issue with where to put the alternate labels without a major rewrite of the query.

(16 Nov '12, 11:39) Sweet Burlap Sweet%20Burlap's gravatar image

Thanks Sweet Burlap.

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

?newLabel isn't defined so ?newLabel rdfs:label ?label and ?newLabel skos:prefLabel ?label will be skipped.

?newLabel and ?label need to be defined in the WHERE clause.

permanent link

answered 15 Nov '12, 17:50

AndyS's gravatar image

AndyS ♦
accept rate: 33%

I would guess that ?newLabel is actually meant to be ?newClass

(15 Nov '12, 19:27) Rob Vesse ♦ Rob%20Vesse's gravatar image

Thanks AndyS and Rob,

Sorry if my question was not clear, how do I define it as I tried a couple of options without success?

(16 Nov '12, 00:03) 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



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:


question asked: 15 Nov '12, 17:03

question was seen: 1,077 times

last updated: 16 Nov '12, 12:29