In this level of my work, I need to extract a class synonyms from MeSH ontology. I am searching for the right syntax for the SPARQL query: how synonyms are they stored in MeSH? and how can I extract them?
-
1@safé: what do you mean exactly by "class synonyms"? the OWL equivalent classes? Also, it would help if you add to your question a portion of the ontology that you're working with, and an example of what you're trying to extract: this will help in understanding what you're doing, and in suggesting solutions. – MarcoS May 19 '11 at 06:47
-
I don't know exactly how those classes are classified in OWL, But I am sure that they aren't equivalent. For exemple, when using MeSH Browser and adding "cancer" as query, all the information returned are about "neoplasm" because in MeSH "cancer" and "neoplasm" are synonyms [link](http://www.nlm.nih.gov/cgi/mesh/2011/MB_cgi?mode=&index=8969&view=concept ) (see the related concepts). However I don't know how this relation is descriped in OWL and how to extract it using sparql. – safé May 19 '11 at 08:59
-
@safé: I'm afraid I can't help you. In order to write a SPARQL query you must know the structure of RDF graph you want to query. You can query an OWL ontology, provided that you know how it's organized (and so, how its RDF serialization looks like). I recommend that you find out the structure of the "MeSH" ontology, and then ask again your question. As it is at the moment is like asking "how do I extract information from a database that I don't know how it's made"? ... impossible :) – MarcoS May 19 '11 at 09:14
-
I already have the owl file of that ontology, but I am not able to identify how synonyms are stored, that's why I posted this question here, maybe I can find someone who had worked with this ontology in the past and is able to help me. Maybe I should change my question to "In which structure synonyms are stored in MeSH ontology?" – safé May 19 '11 at 09:27
-
@safé: ah! if you have the OWL file, than it's different! Based on your example above, you could locate the OWL class for "Cancer", and that for "Neoplasm" and post the code here: that would help me and others in figuring out how to help you – MarcoS May 19 '11 at 09:53
-
I can't find a class named "cancer" and this is the code for "neoplasm:
-
@safé: I've looked at the link that you posted, and that ontology seems just a long list of classes with `subClassOf` relations. So, it's just a class hierarchy. The only way you can navigate it, is by following `subClassOf` relations. I've read also this [page](http://bike.snu.ac.kr/?q=node/207), and it seems that your file has been generated somehow automatically from other files, and it contains only the MeSH terms. You may want to contact the author (there's an email address there), and ask him. Good luck. – MarcoS May 19 '11 at 12:14
-
Really thank you MarcoS, that's what i will do, i will email the author.. if I find any solution, I will post it here. – safé May 19 '11 at 12:19
-
@safé: you're welcome :) I hope you find a solution, and I look forward to read a follow-up on this. – MarcoS May 19 '11 at 12:46
1 Answers
I am not sure what you mean by synonyms. But after looking at the MeSH ontology (downloaded from here). I run the following query to list all the different predicates:
SELECT DISTINCT ?p where { ?s ?p ?o }
... and I get ...
<http://www.w3.org/2004/02/skos/core#historyNote>
<http://www.nlm.nih.gov/mesh/2006#considerAlso>
<http://www.nlm.nih.gov/mesh/2006#recordAuthorizer>
<http://www.nlm.nih.gov/mesh/2006#dateEstablished>
<http://www.nlm.nih.gov/mesh/2006#dateCreated>
<http://www.nlm.nih.gov/mesh/2006#onlineNote>
<http://www.nlm.nih.gov/mesh/2006#activeMeSHYear>
<http://www.nlm.nih.gov/mesh/2006#historyNote>
<http://www.w3.org/2004/02/skos/core#related> <<<---
<http://www.w3.org/2004/02/skos/core#broader> <<<---
<http://www.nlm.nih.gov/mesh/2006#recordMaintainer>
<http://www.w3.org/2004/02/skos/core#scopeNote>
<http://www.w3.org/2004/02/skos/core#altLabel>
<http://www.w3.org/2004/02/skos/core#prefLabel>
<http://www.nlm.nih.gov/mesh/2006#preferredCombination> <<<---
<http://www.nlm.nih.gov/mesh/2006#publicMeSHNote>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://www.w3.org/2004/02/skos/core#annotation>
<http://www.w3.org/2004/02/skos/core#hiddenLabel>
<http://www.nlm.nih.gov/mesh/2006#recordOriginator>
<http://www.nlm.nih.gov/mesh/2006#runningHead>
<http://www.nlm.nih.gov/mesh/2006#dateRevised>
... the predicates with <<<---
make me suppose some sort relationship between resources.
For instance if we try skos:related
with the following query:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?slabel ?olabel
WHERE {
?s skos:related ?o .
?s skos:prefLabel ?slabel .
?o skos:prefLabel ?olabel .
}
we get things like ...
"Anesthetics" "Adjuvants, Anesthesia"
"Prostatic Neoplasms" "Prostate-Specific Antigen"
"Elbow" "Tennis Elbow"
"Uterine Hemorrhage" "Menorrhagia"
"Ecology" "Environmental Health"
"Endocarditis, Bacterial" "Aneurysm, Infected"
( .... and many more )
If you try skos:broader
with the following query (prefixes omitted). Notice that skos:broader
is used to define hierarchies of concepts, so it has different semantics than skos:related
SELECT ?slabel ?olabel
WHERE {
?s skos:broader ?o .
?s skos:prefLabel ?slabel .
?o skos:prefLabel ?olabel .
}
you get ...
"Healthy People Programs" "Health Promotion"
"Suggestion" "Hypnosis"
"Sodium Iodide" "Iodides"
"Unnecessary Procedures" "Health Services Misuse"
"Bornanes" "Norbornanes"
"Prajmaline" "Ajmaline"
"Vestibular Nerve" "Vestibulocochlear Nerve"
"Adenolymphoma" "Neoplasms, Complex and Mixed"
"Child, Gifted" "Child, Exceptional"
"Tooth Germ" "Tooth Components"
"Breast Self-Examination" "Self-Examination"
( ... and many more)
Bottom line, if you don't know the schema run some exploratory queries and try to see what's in there.
Edit: Queries for OWL file
@safé I think you are right, there are not such relations between classes in the OWL file you're using.
The following query gives you all the OWL classes:
SELECT DISTINCT ?p WHERE { ?s a <http://www.w3.org/2002/07/owl#Class> . }
... and this other one gives all predicates used in any class:
SELECT DISTINCT ?p WHERE {
?s a <http://www.w3.org/2002/07/owl#Class> .
?s ?p ?o }
... this last query only returns:
<http://www.w3.org/2000/01/rdf-schema#subClassOf>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
Actually in that OWL file you only have things like:
<http://org.snu.bike/MeSH#antimony_sodium_gluconate> rdf:type owl:Class .
and ...
<http://org.snu.bike/MeSH#antimony_sodium_gluconate> rdfs:subClassOf <http://org.snu.bike/MeSH#gluconate>.
This means that the only thing that is declared in that OWL file is a hierarchy of classes and no synonyms are declared.
If somehow you want to extract all subClasses do ...
SELECT * WHERE {
?subClass <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?upperClass
}

- 1
- 1

- 16,287
- 5
- 37
- 56
-
What you write here is interessant, However the ontology you used is saved in an rdf file, while I need to use an OWL file because I am extracting classes and subclasses too. – safé May 19 '11 at 13:37
-
Where is that OWL file ? How can I access it to investigate further ? – Manuel Salvadores May 19 '11 at 13:44
-
Here is the OWL file I am using [link] (http://bike.snu.ac.kr/sites/default/files/meshonto.owl) but I don't thinh this is containing the relations I am searching for. – safé May 19 '11 at 13:47
-
@safé see new edition of the answer (bottom part). Also don't forget to vote up answers that you find useful in SO. Your profile has 0 upvotes and that is not good if you want to get help from people. Hope my answer helps. – Manuel Salvadores May 19 '11 at 14:25
-
Thank you... as I thought and as was discussed before, this file doesn't contain everything.. I will look for another version, or try to find another way to resolve my problem. (and thank you for the advice about the upvote ) – safé May 19 '11 at 14:39
-
This is a really great answer. Thank you @msalvadores , I've found it helpful to me too. – Aidos Jun 08 '16 at 12:13