Getting Topic Labels |
Top Previous Next |
To Retrieve all Labels for a Topic The special predicate http://www.networkedplanet.com/tmsparql/label can be used to retrieve all labels of a topic. For example the following query finds all person topics and returns the topic address and all of its labels. PREFIX ont: <http://psi.networkedplanet.com/types/> In the query above, if a topics has two labels then results set will have two rows for that topics - in each row the topic address in the ?t column will be the same, but the ?l column will contain each label value on a separate row.
To Retrieve a Specific Label for a Topic To return the label for a topic in a particular language, you can add the language code to the end of the predicate URL - for example the predicate http://www.networkedplanet.com/tmsparql/label/en-us returns only the US English label for the topic. You should be careful when using this more specific type of query because topics that do not have a label in the specified language will not be returned unless you put the label triple pattern in an OPTIONAL block. The following query finds only those products that have a French label: PREFIX ont: <http://psi.networkedplanet.com/types/> The following query finds the French and English labels for products and will return products that have a French label, an English label or neither PREFIX ont: <http://psi.networkedplanet.com/types/>
|