ivci:nuva_sparql_queries

NUVA SPARQL Queries

These can be run against the SPARQL Query engine

# All vaccines against smallpox
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX nuva: <http://data.esante.gouv.fr/NUVA#> 
PREFIX nuvs: <http://data.esante.gouv.fr/NUVA/nuvs#>
SELECT ?vac ?vl FROM <http://data.esante.gouv.fr/graph/terminologie-nuva> WHERE { 
 ?dis rdfs:subClassOf nuva:Disease .
 ?dis rdfs:label "Smallpox-Monkeypox"@en .
 ?vac rdfs:subClassOf nuva:Vaccine .
    ?vac rdfs:label ?vl FILTER(lang(?vl)='en'||lang(?vl)=''). 
 ?vac nuvs:containsValence ?val . 
 ?val nuvs:prevents ?dis 
 }
# All Tdap only vaccines
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX nuva: <http://data.esante.gouv.fr/NUVA#> 
PREFIX nuvs: <http://data.esante.gouv.fr/NUVA/nuvs#>
SELECT ?vac ?vl FROM <http://data.esante.gouv.fr/graph/terminologie-nuva> WHERE {
    ?val1 skos:altLabel 'd'@en .
    ?val2 skos:altLabel 'T'@en .
    ?val3 skos:altLabel 'ap'@en .
    ?vac nuvs:containsValence ?val1 .
    ?vac nuvs:containsValence ?val2 .
    ?vac nuvs:containsValence ?val3 .
    ?vac rdfs:label ?vl FILTER(lang(?vl)='en'||lang(?vl)='')
    FILTER NOT EXISTS {
        ?vac nuvs:containsValence ?val .
        FILTER (?val NOT IN (?val1,?val2,?val3))
    }
 }
 
# Convert from CIS to CNK
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX nuva: <http://data.esante.gouv.fr/NUVA#> 
PREFIX nuvs: <http://data.esante.gouv.fr/NUVA/nuvs#>
SELECT ?vac ?vl ?cnk FROM <http://data.esante.gouv.fr/graph/terminologie-nuva> WHERE { 
 ?vac skos:exactMatch nuva:CIS-65017887 .
 ?vac rdfs:label ?vl .
 ?vac skos:exactMatch ?cnk .
 ?cnk rdfs:subClassOf nuva:CNK .
 }
 
# Vaccines codable as J07CA08
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX nuva: <http://data.esante.gouv.fr/NUVA#> 
PREFIX nuvs: <http://data.esante.gouv.fr/NUVA/nuvs#>
SELECT DISTINCT ?vac ?lvac FROM <http://data.esante.gouv.fr/graph/terminologie-nuva> WHERE { 
 ?vac rdfs:subClassOf nuva:Vaccine . 
 ?vac rdfs:label ?lvac FILTER (lang(?lvac)='fr'||lang(?lvac)=''). 
 ?rvac skos:exactMatch nuva:ATC-J07CA08 .
 FILTER NOT EXISTS { 
   ?rvac nuvs:containsValence ?rval . 
   FILTER NOT EXISTS {
   ?vac  nuvs:containsValence/rdfs:subClassOf* ?rval} 
   }  
  }
  
# Seek parents
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX nuva: <http://data.esante.gouv.fr/NUVA#> 
PREFIX nuvs: <http://data.esante.gouv.fr/NUVA/nuvs#>
SELECT ?vac ?lvac FROM <http://data.esante.gouv.fr/graph/terminologie-nuva> WHERE { 
 ?rvac rdfs:label "BOOSTRIX" .
 ?vac rdfs:subClassOf nuva:Vaccine . 
 ?vac nuvs:isAbstract true .
 ?vac rdfs:label $lvac FILTER (lang(?lvac)='en') . 
 # Only vaccines having all valences of the reference vaccine
 FILTER NOT EXISTS { 
   # Search all valences of ?vac that are not parents of valences from ?rvac
   ?vac nuvs:containsValence ?val . 
   FILTER NOT EXISTS {
     # Empty if ?vac is not a parent of any ?rvac
     ?rvac nuvs:containsValence/rdfs:subClassOf* ?val} 
     } 
   }
# Seek ATC Code
# Similar to Seek parents
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX nuva: <http://data.esante.gouv.fr/NUVA#> 
PREFIX nuvs: <http://data.esante.gouv.fr/NUVA/nuvs#>
SELECT ?vac ?lvac ?atc FROM <http://data.esante.gouv.fr/graph/terminologie-nuva> WHERE { 
 ?rvac rdfs:label "BOOSTRIX" .
 ?vac rdfs:subClassOf nuva:Vaccine . 
 ?vac nuvs:isAbstract true .
 ?vac skos:exactMatch ?code .
 ?code rdfs:subClassOf nuva:ATC .
 ?code skos:notation ?atc .
 ?vac rdfs:label $lvac FILTER (lang(?lvac)='en') . 
 FILTER NOT EXISTS { 
   ?vac nuvs:containsValence ?val . 
   FILTER NOT EXISTS {
     ?rvac nuvs:containsValence/rdfs:subClassOf* ?val} 
     } 
   }
  • ivci/nuva_sparql_queries.txt
  • Last modified: 2023/09/03 13:54
  • by fkaag