0

I created an ontology using SKOS and it includes two concepts, concept1 and concept2. And I added one preferred label Temperature Sensor, and three alternative labels Temperature@en, Temp@en and T@en into the concept1.

What I expect is when I send a request to a target concept containing Temp, T or Temperature, the SKOS will respond with a same concept Temperature Sensor (which are defined in preferred label).

How can I achieve this? Is it possible to achieve this using SKOS? Part of rdf file is shown as below.

<skos:Concept rdf:about="TemperatureSensor">    
<skos:altLabel xml:lang="en">T</skos:altLabel>    
<skos:altLabel xml:lang="en">Temp</skos:altLabel>    
<skos:altLabel xml:lang="en">Temperature</skos:altLabel>     
<skos:prefLabel xml:lang="en">TemperatureSensor</skos:prefLabel>      
<skos:inScheme rdf:resource="conceptSchemeSensors"/></skos:Concept>
Novamartin
  • 13
  • 3
  • "when I request a concept" How are you querying this data? Using SPARQL? By reading through the file manually? SKOS is just the *schema*, and the answer to "Is it possible to achieve this using SKOS?" is simply "yes, just use the value of prefLabel instead of any altLabel". But you need to tell us how you're querying the data. – Joshua Taylor Jan 15 '15 at 16:52
  • Also, it's much easier to work with *complete* examples. While "skos:" is a standard prefix, it's not defined in your data. You've also got relative IRIs (conceptSchemeSensors). This imposes an additional burden on anyone trying to use it in a response. Please provide *complete* examples. – Joshua Taylor Jan 15 '15 at 16:54
  • @Joshua Taylor I use SPARQL to request an ontology after loading an ontology file. Refer to your SPARQL query code, I soveld my problem. But there is a long way to go in SKOS. Thanks for your help. – Novamartin Jan 16 '15 at 07:24
  • I'm glad that my answer helped, but I'm not sure what you mean by "But there is a long way to go in SKOS." – Joshua Taylor Jan 16 '15 at 14:35
  • I just start doing a project on semantic web and I am new to SKOS, to Semantic Web. I hope I could ask for help when I encounter problems on Semantic Web. Thanks again. – Novamartin Jan 17 '15 at 10:03

1 Answers1

1

The data you provided isn't complete; it's missing some prefix declarations, and it uses relative IRIs but doesn't define a base IRI. Here's some complete data we can use:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:skos="http://www.w3.org/2004/02/skos/core#">
  <skos:Concept rdf:about="http://stackoverflow.com/q/27958866/1281433/TemperatureSensor">
    <skos:altLabel xml:lang="en">T</skos:altLabel>
    <skos:altLabel xml:lang="en">Temp</skos:altLabel>
    <skos:altLabel xml:lang="en">Temperature</skos:altLabel>
    <skos:prefLabel xml:lang="en">TemperatureSensor</skos:prefLabel>
    <skos:inScheme rdf:resource="http://stackoverflow.com/q/27958866/1281433/conceptSchemeSensors"/>
  </skos:Concept>
</rdf:RDF>

Here's a SPARQL query that we can run over that same data. It retrieves all the concepts, their preferred labels, and their alternative labels. Then it uses coalesce to take any of the preferred labels, and if there are none of those, any of the alternative labels for the concept.

prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix skos:  <http://www.w3.org/2004/02/skos/core#>
prefix : <http://stackoverflow.com/q/27958866/1281433/>

select ?concept (coalesce(sample(?prefLabel),sample(?altLabel)) as ?label) where {
  ?concept skos:altLabel ?altLabel ;
           skos:prefLabel ?prefLabel .
}
group by ?concept
-----------------------------------------------
| concept            | label                  |
===============================================
| :TemperatureSensor | "TemperatureSensor"@en |
-----------------------------------------------
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353