Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract ontology mappings (excatMatch,...) #302

Closed
3 tasks done
Tracked by #298
syphax-bouazzouni opened this issue Sep 14, 2022 · 2 comments
Closed
3 tasks done
Tracked by #298

Extract ontology mappings (excatMatch,...) #302

syphax-bouazzouni opened this issue Sep 14, 2022 · 2 comments

Comments

@syphax-bouazzouni
Copy link
Contributor

syphax-bouazzouni commented Sep 14, 2022

Requirement

If inside the class/concepts defintion are defined mapping relations (need to be defined and listed), we should extract them and add them to the mapping list of the class/concept.

Actually they are only showed the class/concept details

Image

The proposed solution

is to upgrade the SPARQL query used to fetch the mapping, defined in def self.mappings_ontologies(sub1, sub2, page, size, classId = nil, reload_cache = false)

The request will go from

SELECT DISTINCT ?s1 ?s2 ?g ?source ?o
WHERE {
 {  
     GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> {     
      ?s1 <http://bioportal.bioontology.org/ontologies/umls/cui> ?o .
     } 
     GRAPH ?g {      
       ?s2 <http://bioportal.bioontology.org/ontologies/umls/cui> ?o .  
     }  
     BIND ('CUI' AS ?source) 
 } 
 UNION 
 { 
     GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> {
      ?s1 <http://data.bioontology.org/metadata/def/mappingSameURI> ?o .
     } 
     GRAPH ?g {
      ?s2 <http://data.bioontology.org/metadata/def/mappingSameURI> ?o .
     } 
     BIND ('SAME_URI' AS ?source 
} 
UNION
{  
    GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> { 
     ?s1 <http://data.bioontology.org/metadata/def/mappingLoom> ?o .
    } 
    GRAPH ?g {
     ?s2 <http://data.bioontology.org/metadata/def/mappingLoom> ?o .
    }
    BIND ('LOOM' AS ?source)
 } 
 UNION 
 { 
    GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> { 
     ?s1 <http://data.bioontology.org/metadata/def/mappingRest> ?o . 
	  } 
    GRAPH ?g {
     ?s2 <http://data.bioontology.org/metadata/def/mappingRest> ?o .  
    }  
    BIND ('REST' AS ?source)}
 }
 FILTER ((?s1 != ?s2) || (?source = 'SAME_URI'))
 FILTER (!STRSTARTS(str(?g),'http://data.bioontology.org/ontologies/E-PHY'))
} 
OFFSET 0 LIMIT 50

To

SELECT DISTINCT ?s1 ?s2 ?g ?source ?o
WHERE {
 {  
     GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> {     
      ?s1 <http://bioportal.bioontology.org/ontologies/umls/cui> ?o .
     } 
     GRAPH ?g {      
       ?s2 <http://bioportal.bioontology.org/ontologies/umls/cui> ?o .  
     }  
     BIND ('CUI' AS ?source) 
 } 
 UNION 
 { 
     GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> {
      ?s1 <http://data.bioontology.org/metadata/def/mappingSameURI> ?o .
     } 
     GRAPH ?g {
      ?s2 <http://data.bioontology.org/metadata/def/mappingSameURI> ?o .
     } 
     BIND ('SAME_URI' AS ?source 
} 
UNION
{  
    GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> { 
     ?s1 <http://data.bioontology.org/metadata/def/mappingLoom> ?o .
    } 
    GRAPH ?g {
     ?s2 <http://data.bioontology.org/metadata/def/mappingLoom> ?o .
    }
    BIND ('LOOM' AS ?source)
 } 
 UNION 
 { 
    GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> { 
     ?s1 <http://data.bioontology.org/metadata/def/mappingRest> ?o . 
	  } 
    GRAPH ?g {
     ?s2 <http://data.bioontology.org/metadata/def/mappingRest> ?o .  
    }  
    BIND ('REST' AS ?source)}
 }
 UNION 
 { 
    GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> { 
     ?s1 <http://data.bioontology.org/metadata/def/mappingRest> ?o . 
	  } 
    GRAPH ?g {
     ?s2 <http://data.bioontology.org/metadata/def/mappingRest> ?o .  
    }  
    BIND ('REST' AS ?source)}
 }
UNION
{  
   GRAPH <http://data.bioontology.org/ontologies/E-PHY/submissions/1> {     
      ?s1 <http://www.w3.org/2004/02/skos/core#exactMatch> ?s2 .
     } 
     BIND( <http://data.bioontology.org/ontologies/E-PHY/submissions/1> as ?g)
     BIND( ?s2 AS ?o)
     BIND ('SKOS:EXACT_MATCH' AS ?source) 
 } 
 FILTER ((?s1 != ?s2) || (?source = 'SAME_URI'))
 FILTER (!STRSTARTS(str(?g),'http://data.bioontology.org/ontologies/E-PHY') || ((?source = 'SKOS:EXACT_MATCH')))
} 
OFFSET 0 LIMIT 50

TODO

  • Define the list of mapping relation to extract
  • Update the SPARQL query
  • Test if it works
@syphax-bouazzouni
Copy link
Contributor Author

The list of mapping relation to extract (for now)

  • skos:closeMatch
  • skos:exactMatch
  • skos:broadMatch
  • skos:narrowMatch
  • skos:relatedMatch

@jonquet
Copy link
Contributor

jonquet commented Oct 25, 2022

Note for later : we will need to add alos:
owl:sameAs and oboInOwl:hasDbXref has not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants