Advanced Queries

Queries on this page are "advanced queries" which provide a sample query and explain the arguments and output of the query without explaining the syntax. If you're new to SPARQL, begin with the sample queries to get a handle of the syntax before using the advanced queries here to interrogate the service with relevant queries.

In this page


General Resource Info


Q1 - list resource names in the service

  • i.e. individuals of type srro:ServiceRdfResource
# Q1 - list resource names in the service

prefix srro: <http://cbiit.nci.nih.gov/srro#>
select ?name
from <http://cbiit.nci.nih.gov/srro>
where {
  values ?type { srro:ServiceRdfResource }
  ?name a ?type .
}

Expected results: returned 6 rows.

name
srro:GO
srro:NCIt
srro:SRRO
srro:caDSR
srro:NCItInferred
srro:NCIT_Metathesaurus

Q2 - list the resource intents/purpose in the service

  • i.e. individuals of type srro:ResourceIntent
# Q2 - list resource intents/purpose in the service

prefix sd: <http://www.w3.org/ns/sparql-service-description#>
prefix omv: <http://omv.ontoware.org/2005/05/ontology#>
prefix srro: <http://cbiit.nci.nih.gov/srro#>
select ?name
from <http://cbiit.nci.nih.gov/srro>
where {
  values ?type { srro:ResourceIntent }
  ?name a ?type .
}

Expected results: returned 3 rows.

name
srro:metadata
srro:schema
srro:terminology

Other queries that are similar to Q1 & Q2 (only the values ?type { ... } changes):

  • list Named Graphs in the service - sd:NamedGraph
  • list Ontology Domains in the service - omv:OntologyDomain
  • list Organizations referenced in the service - omv:Organisation

Q3 - resources with a given intent

  • e.g. get the resources of type srro:metadata
# Q3 - get the resources with a given intent, e.g. srro:metadata

prefix srro: <http://cbiit.nci.nih.gov/srro#>
select ?resource
from <http://cbiit.nci.nih.gov/srro>
where {
  values ?intent { srro:metadata }
  ?resource srro:hasIntent ?intent .
}

Expected Results: returned 1 row.

resource
srro:caDSR

Q4 - get the graph name of a resource given its name

  • e.g. srro:GO
# Q4 - get the graph name of a resource given its name, e.g. srro:GO

prefix sd:  <http://www.w3.org/ns/sparql-service-description#>
prefix srro: <http://cbiit.nci.nih.gov/srro#>
select (IRI(?graph) as ?graph_name)
from <http://cbiit.nci.nih.gov/srro>
where {
  values ?resource { srro:GO }
  ?resource srro:inNamedGraph/sd:name ?graph .
}

Expected Results: returned 1 row.

graph_name
https://www.geneontology.org/GO

Q5 - find all the properties in a resource graph

# Q5 - find all the properties in a resource graph, e.g. NCIt

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
SELECT DISTINCT ?property ?property_label
FROM  <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
WHERE
{
  ?s ?property ?o .
  OPTIONAL{ ?property rdfs:label ?property_label}
}

Expected Results: returned 239 rows. Here are the first 5 rows.

property property_label
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
rdfs:label label
rdfs:subPropertyOf
owl:equivalentClass
<http://www.w3.org/1999/02/22-rdf-syntax-ns#first>

Q6 - list the common properties of a resource

  • e.g. the definition, synonyms, preferred term, identifier, instances of classes under srro:ResourceEntityDescription for resource srro:NCIt
# Q6 - list the common properties of a given resource, e.g. srro:NCIt 

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select distinct ?common_property ?resource_property
from <http://cbiit.nci.nih.gov/srro>
where {
  values ?resource { srro:NCIt }
  values ?parentClass { srro:ResourceEntityDescription }
  ?common_property rdfs:subClassOf ?parentClass .
  ?property rdfs:range ?common_property .
  ?resource ?property ?resource_property .
}

Expected Results: returned 4 rows.

row num common_property resource_property
1 srro:Definition http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#P97
2 srro:Identifier http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#NHC0
3 srro:PreferredTerm http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#P108
4 srro:Term http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#P90

Q7 - get a specific "common" property of a resource

  • e.g. identifier (srro:Identifier) for srro:NCIt
# Q7 - get a specific "common" property, e.g. 'srro:Identifier', of a resource, e.g. srro:NCIt

prefix srro: <http://cbiit.nci.nih.gov/srro#>

select ?specific_property
from <http://cbiit.nci.nih.gov/srro>
where {
  values ?resource {  srro:NCIt }
  values ?common_property { srro:Identifier }
  ?specific_property a ?common_property .
  ?resource ?property ?specific_property .
}

Expected Results: 1 row.

specific_property
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#NHC0

Terminology resource (vocabulary, ontology, thesaurus...)

Q8 - get a vocabulary concept by its identifier & return its "common" property/values

  • returns IRI, identifier, label, collection of terms, and collection of definitions, in sparql json
# Q8 - get a vocabulary concept by its identifier, e.g. "GO:0000070", and return its "common" properties with values

prefix srro: <http://cbiit.nci.nih.gov/srro#>
select distinct  ?entity ?identifier ?preferred_term (group_concat( distinct str(?term); separator="\n") as ?terms)  (group_concat( distinct str(?def); separator="\n") as ?definitions)
from <http://www.geneontology.org/GO>
where {
  values ?identifier { "GO:0000070"  }
  ?entity ?identifier_property ?identifier .
  ?entity ?preferred_term_property ?preferred_term .
  optional { ?entity ?term_property ?term }
  optional { ?entity ?definition_property ?def }
  {
    select ?identifier_property  ?preferred_term_property ?term_property ?definition_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource { srro:GO }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
      ?resource srro:hasTerm ?term_property .
      ?resource srro:hasDefinition ?definition_property .
    }
  }
}

Expected Results: returned 1 row.

entity identifier preferred_term terms definitions
http://purl.obolibrary.org/obo/GO_0000070 GO:0000070 mitotic sister chromatid segregation mitotic chromosome segregation The cell cycle process in which replicated homologous chromosomes are organized and then physically separated and apportioned to two sets during the mitotic cell cycle. Each replicated chromosome, composed of two sister chromatids, aligns at the cell equator, paired with its homologous partner. One homolog of each morphologic type goes into each of the resulting chromosome sets.

Q9 - get a vocabulary concept by its identifier & return all its property/values

  • returns domain json containing all attributes (can keep as sparql json for now)
# Q9 - get a vocabulary concept by its identifier, e.g. "C113525", and return all its properties with values

prefix srro: <http://cbiit.nci.nih.gov/srro#>
select distinct ?entity (group_concat( distinct str(?name_value); separator="\n") as ?all_props)
from <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
where {
  values ?identifier { "C113525"  }
  ?entity ?identifier_property ?identifier ;
          ?property ?value .
  ?property  ?preferred_term_property ?property_name .
  bind (concat(str(?property_name), ": ", str(?value)) as ?name_value)
  {
    select ?identifier_property ?preferred_term_property ?term_property ?definition_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:NCIt }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
      ?resource srro:hasTerm ?term_property .
      ?resource srro:hasDefinition ?definition_property .
    }
  }
} order by ?entity

Expected Results: returned 1 row.

entity all_props
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113525 Concept_In_Subset: http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C116977 Concept_In_Subset: http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C142799 Concept_In_Subset: http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C142800 Contributing_Source: CTRP DEFINITION: Immunoglobulin J chain (159 aa, ~18 kDa) is encoded by the human JCHAIN gene. This protein plays a role in the joining of antibody structures. Display_Name: Immunoglobulin J Chain FULL_SYN: IgJ Chain FULL_SYN: Immunoglobulin J Chain FULL_SYN: J Chain FULL_SYN: JCHAIN FULL_SYN: Joining Chain of Multimeric IgA and IgM Gene_Product_Encoded_By_Gene: http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113522 Gene_Product_Is_Physical_Part_Of: http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C565 Gene_Product_Is_Physical_Part_Of: http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C569 Gene_Product_Plays_Role_In_Biological_Process: http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C16712 OMIM_Number: 147790 Preferred_Name: Immunoglobulin J Chain Semantic_Type: Amino Acid, Peptide, or Protein Swiss_Prot: P01591 UMLS_CUI: C0021035 code: C113525

Q10 - list vocabulary concepts related to a focus concept (all related concepts and their relations to the given concept)

  • returns entity IRI, property IRI, property label, value IRI, value label, in sparql json
# Q10 - list vocabulary concepts related to a focus concept by its identifier, e.g. "C113525" 

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix owl: <http://www.w3.org/2002/07/owl#>
select distinct ?entity ?property ?property_name ?value ?value_label
from <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
where {
  values ?identifier { "C113525" }
  ?entity ?identifier_property ?identifier ;
  ?property ?value .
  ?property a owl:ObjectProperty .

optional { ?property ?preferred_term_property ?property_name . } optional { ?value ?preferred_term_property ?value_label } { select ?identifier_property ?preferred_term_property from <http://cbiit.nci.nih.gov/srro> where { values ?resource { srro:NCIt } ?resource srro:hasIdentifier ?identifier_property . ?resource srro:hasPreferredTerm ?preferred_term_property . } } }

Expected Results: returned 6 rows.

entity property property_name value value_label
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113525 http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#R53 Gene_Product_Plays_Role_In_Biological_Process http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C16712 Humoral Immunity
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113525 http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#R54 Gene_Product_Encoded_By_Gene http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C25790 Immunoprotein Gene
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113525 http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#R53 Gene_Product_Plays_Role_In_Biological_Process http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C17937 Immune System Process
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113525 http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#R54 Gene_Product_Encoded_By_Gene http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113522 JCHAIN Gene
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113525 http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#R51 Gene_Product_Is_Physical_Part_Of http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C565 IgA
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C113525 http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#R51 Gene_Product_Is_Physical_Part_Of http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C569 IgM

Q11 - list direct(immediate) subclasses of concept

  • returns label, IRI, identifier, in sparql json (as Q12, but no path expression)
# Q11 - list direct(immediate) subclasses of a concept by its identifier, e.g. "C20027"

prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select distinct ?subClass ?subClassLabel ?subClassId
from <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
where {
  values ?identifier { "C20027" }
  ?entity ?identifier_property ?identifier .
  ?subClass rdfs:subClassOf ?entity ;
  ?identifier_property ?subClassId ;
  ?preferred_term_property ?subClassLabel .
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:NCIt }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
    }
  }
}

Expected Results: returned 20 rows. Here are the first 5 rows.

subClass subClassLabel subClassId
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C38576 Translation Process Protein C38576
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C20464 Cytokine C20464
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C16934 Oncoprotein C16934
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C20982 Tumor Suppressor Protein C20982
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C18073 Structural Protein C18073

Q12 - list all subclasses (including both direct and indirect subclasses) of a class

  • returns subclass IRI, label, identifier, in sparql json
# Q12 - list all subclasses (including both direct and indirect subclasses) of a class by its identifier, e.g. "C20027"

prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select distinct ?subClass ?subClassLabel ?subClassId
from <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
where {
  values ?identifier { "C20027" }
  ?entity ?identifier_property ?identifier .
  ?subClass rdfs:subClassOf+ ?entity ;
  ?identifier_property ?subClassId ;
  ?preferred_term_property ?subClassLabel .
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:NCIt }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
    }
  }
}

Expected Results: returned 6651 rows. Here are the first 5 rows.

subClass subClassLabel subClassId
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C101403 Progranulin C101403
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C101100 NUT Family Member 2A C101100
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C101663 Transmembrane Protein 216 C101663
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C16492 Cytoskeletal Protein C16492
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C101308 NACHT, LRR and PYD Domains-Containing Protein 6 C101308

Q13 - check if a class is a subclass of another class, which could be immediate ancestor or non-immediate ancestor of the class

  • return: true/false
# Q13 - check if a class (e.g. "C20027") is a subclass of another class (e.g. "C113525")

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
ask {
  graph <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf> {
  values ?topClassID { "C20027" }
  values ?bottomClassID { "C113525" }
  ?topClass ?identifier_property ?topClassID .
  ?bottomClass ?identifier_property ?bottomClassID .
  ?bottomClass rdfs:subClassOf+ ?topClass .
  {
    select ?identifier_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:NCIt }
      ?resource srro:hasIdentifier ?identifier_property .
    }
  }
}
}

Expected Results: True

Data element resource (common data elements - CDE)

Q14 - get a data element by its identifier & return its "common" property/values

  • returns label, IRI, identifier, definition, a variant can include the collection of terms, in sparql json
# Q14 - get a data element by its identifier, e.g. "2936520", and return its "common" properties with values

prefix srro: <http://cbiit.nci.nih.gov/srro#>
select distinct  ?entity ?identifier ?preferred_term ?term ?definition
from <http://cbiit.nci.nih.gov/caDSR>
where {
  values ?identifier { "2936520" }
  ?entity ?identifier_property ?identifier .
  ?entity ?preferred_term_property ?preferred_term .
  optional { ?entity ?term_property ?term }
  optional { ?entity ?definition_property ?definition }
  {
    select ?identifier_property  ?preferred_term_property ?term_property ?definition_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource { srro:caDSR }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
      ?resource srro:hasTerm ?term_property .
      ?resource srro:hasDefinition ?definition_property .
    }
  }
}

Expected Results: returned 1 row.

entity identifier preferred_term term definition
http://cbiit.nci.nih.gov/caDSR#DE2936520 2936520 Person Dual X-ray Absorptometry Body Composition Value Measurement of the study subject lean body mass using Dual-energy X-ray Absorptiometry (DXA) measured at 8 years and older Body composition measured by Dual-energy X-ray Absorptiometry (DXA) measured at 8 years and older. [Manually curated]_The numerical result of the determination of the vertical force exerted by the mass of an individual as a result of gravity.

Q15 - get a data element by its identifier

  • returns domain json containing all attributes (can keep as sparql json for now)
# Q15 - get a data element by its identifier, e.g. "2936520", and return all its properties with values

prefix srro: <http://cbiit.nci.nih.gov/srro#>
select distinct ?entity (group_concat( distinct str(?name_value); separator="\n") as ?all_props)
from <http://cbiit.nci.nih.gov/caDSR>
where {
  values ?identifier { "2936520" }
  ?entity ?identifier_property ?identifier ;
  ?property ?value .
  bind (concat(replace(str(?property), "http://.+[#/]", ""), ": ", str(?value)) as ?name_value)
  {
    select ?identifier_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:caDSR }
      ?resource srro:hasIdentifier ?identifier_property .
    }
  }
} order by ?entity

Expected Results: returned 1 row.

entity all_props
http://cbiit.nci.nih.gov/caDSR#DE2936520 DEC_Long_Name: Person Dual X-ray Absorptometry Body Composition DEC_publicId: 2925903 Object_Class: nodeID://b102246570 Property: nodeID://b102246571 Property: nodeID://b102246572 Property: nodeID://b102246573 VD_publicId: 2179445 VD_version: 2 administration_status: RELEASED altLabel: Measurement of the study subject lean body mass using Dual-energy X-ray Absorptiometry (DXA) measured at 8 years and older definition: Body composition measured by Dual-energy X-ray Absorptiometry (DXA) measured at 8 years and older. [Manually curated]_The numerical result of the determination of the vertical force exerted by the mass of an individual as a result of gravity. label: Person Dual X-ray Absorptometry Body Composition Value publicId: 2936520 registration_status: Application short_name: PERS_DXA_BOD_COM_VAL type: http://www.w3.org/2000/01/rdf-schema#Class value_domain_datatype: NUMBER value_domain_type: NonEnumerated version: 1

Q16 - get the object class(es) of a data element

  • return IRIs of the main and minor concepts, include identifier, label, optionally definition
# Q16 - get the object class(es) of a data element by its identifier, e.g. "3101150"

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>
select distinct ?entity ?identifier ?preferred_term ?concept ?order
from <http://cbiit.nci.nih.gov/caDSR>
where {
  values ?identifier { "3101150" }
  ?entity ?identifier_property ?identifier ;
          ?preferred_term_property ?preferred_term ;
          isomdr:Object_Class ?an .
  ?an cmdr:main_concept|cmdr:minor_concept ?concept ;
  cmdr:display_order ?order .
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:caDSR }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
    }
  }
} order by ?order

Expected Results: returned 2 rows.

entity identifier preferred_term concept order
http://cbiit.nci.nih.gov/caDSR#DE3101150 3101150 Simple Approval Status java.lang.String http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C25425 0
http://cbiit.nci.nih.gov/caDSR#DE3101150 3101150 Simple Approval Status java.lang.String http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C47880 1

Q17 - get the permissible values of a data element

  • returns cde's IRI, identifier, PV values and labels, and vocabulary concept IRIs
# Q17 - get the permissible values of a data element by its identifier, e.g. "3103479"

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
select distinct ?entity ?identifier ?preferred_term ?pv_value ?pv_text ?concept ?order
from <http://cbiit.nci.nih.gov/caDSR>
where {
  values ?identifier { "3103479" }
  ?entity ?identifier_property ?identifier ;
          ?preferred_term_property ?preferred_term ;
          isomdr:permitted_value [ isomdr:value ?pv_value ; rdfs:label ?pv_text ; cmdr:has_concept [ cmdr:main_concept|cmdr:minor_concept ?concept ; cmdr:display_order ?order ] ]
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:caDSR }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
    }
  }
} order by ?order

Expected Results: returned 3 rows.

entity identifier preferred_term pv_value pv_text concept order
http://cbiit.nci.nih.gov/caDSR#DE3103479 3103479 Pharmacologic Substance Continue Occurrence Indicator NA Not Applicable http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C48660 0
http://cbiit.nci.nih.gov/caDSR#DE3103479 3103479 Pharmacologic Substance Continue Occurrence Indicator No No http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C49487 0
http://cbiit.nci.nih.gov/caDSR#DE3103479 3103479 Pharmacologic Substance Continue Occurrence Indicator Yes Yes http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C49488 0

Q18 - list all data elements that have a specific object class (in caDSR it would be the main concept of the OC)

  • returns identifier, label, IRI
# Q18 - list all data elements that have a specific object class by its identifier, e.g. ncit:C25190 

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
select distinct ?entity ?identifier ?preferred_term
from <http://cbiit.nci.nih.gov/caDSR>
where {
  values ?concept { ncit:C25190 }
  ?entity ?identifier_property ?identifier ;
          ?preferred_term_property ?preferred_term ;
          isomdr:Object_Class [ cmdr:main_concept ?concept ]
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:caDSR }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
    }
  }
} limit 1000

Expected Results: eturned 1000 rows. Here are the first 5 rows.

entity identifier preferred_term
http://cbiit.nci.nih.gov/caDSR#DE2184687 2184687 Weight in Pounds Number
http://cbiit.nci.nih.gov/caDSR#DE2661003 2661003 Clinical Research Associate Person Telephone Number
http://cbiit.nci.nih.gov/caDSR#DE2773002 2773002 Person Name Prefix java.lang.String
http://cbiit.nci.nih.gov/caDSR#DE2875701 2875701 Person Dose Body Weight Unified Code for Units of Measure C
http://cbiit.nci.nih.gov/caDSR#DE2961276 2961276 Person Female Hormone Use Text

Q18a - given a data element, find other data elements that have the same Object Class. Same object class means the other data elements and the given data element have same main and minor concepts (i.e. the displayOrder match exactly)

  • returns data element, identifier (public_id), and label (preferred_term)
# Q18a - given a data element (e.g. 3101150), find other data elements that have the same Object Class. Same object class means the other data elements and the given data element have same main and minor concepts.

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>
select distinct ?data_element ?public_id ?preferred_term
from <http://cbiit.nci.nih.gov/caDSR>
where {
  ?data_element ?identifier_property ?public_id ;
  ?preferred_term_property ?preferred_term ;
    isomdr:Object_Class [ cmdr:main_concept ?main_concept ] ;
    isomdr:Object_Class [ cmdr:minor_concept ?minor_concept ] .
  {
    values ?given_id { "3101150" }
    ?entity ?identifier_property ?given_id ;
      isomdr:Object_Class [ cmdr:main_concept ?main_concept ] ;
      isomdr:Object_Class [ cmdr:minor_concept ?minor_concept ] .
    {
      select ?identifier_property ?preferred_term_property
      from <http://cbiit.nci.nih.gov/srro>
      where {
        values ?resource {srro:caDSR }
        ?resource srro:hasIdentifier ?identifier_property .
        ?resource srro:hasPreferredTerm ?preferred_term_property .
      }
    }
  }
} 
order by ?public_id 

Expected Results: returned 9 rows.

data_element public_id preferred_term
cmdr:DE3101150 3101150 Simple Approval Status java.lang.String
cmdr:DE3101611 3101611 Simple Approval Status java.lang.String
cmdr:DE3101612 3101612 Simple Approval Created Date java.util.Date
cmdr:DE3101613 3101613 Simple Approval Change Date java.util.Date
cmdr:DE3101614 3101614 Simple Approval Identifier java.lang.Long
cmdr:DE3101615 3101615 Simple Approval Description java.lang.String
cmdr:DE3101616 3101616 Simple Approval Modified By java.lang.String
cmdr:DE3101617 3101617 Simple Approval Name java.lang.String
cmdr:DE3101618 3101618 Simple Approval Display Name java.lang.String

Q18b - given a data element, find other CDEs that have the same Main Concept Object Class

  • returns data element, identifier (public_id), and label (preferred_term)
# Q18b - given a data element (e.g. 3101150), find other data elements that have the same Main Concept Object Class

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>
select distinct ?data_element ?public_id ?preferred_term
from <http://cbiit.nci.nih.gov/caDSR>
where {
  ?data_element ?identifier_property ?public_id ;
                ?preferred_term_property ?preferred_term ;
                isomdr:Object_Class [ cmdr:main_concept ?main_concept ] .
  {
    values ?given_id { "3101150" }
    ?entity ?identifier_property ?given_id ;
            isomdr:Object_Class [ cmdr:main_concept ?main_concept ] .
    {
      select ?identifier_property ?preferred_term_property
      from <http://cbiit.nci.nih.gov/srro>
      where {
        values ?resource {srro:caDSR }
        ?resource srro:hasIdentifier ?identifier_property .
        ?resource srro:hasPreferredTerm ?preferred_term_property .
      }
    }
  }
} LIMIT 100

Expected Results: returned 53 rows. Here are the first 5 rows.

data_element public_id preferred_term
cmdr:DE3946731 3946731 RT Approval Review Time
cmdr:DE3101143 3101143 Approval Display Name java.lang.String
cmdr:DE3101495 3101495 Review Approval Change Date java.util.Date
cmdr:DE3942950 3942950 RT Approval Status
cmdr:DE3101129 3101129 Consensus Approval Required Reviewer Count java.lang.Long

Q19 - list all data elements with the same data element concept ID (the DEC)

  • returns IRI, identifier, label
# Q19 - list all data elements with the same data element concept ID, e.g. "7574294" 

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>
select distinct ?entity ?identifier ?preferred_term
from <http://cbiit.nci.nih.gov/caDSR>
where {
  values ?dec { "7574294" }
  ?entity ?identifier_property ?identifier ;
          ?preferred_term_property ?preferred_term ;
          isomdr:DEC_publicId ?dec .
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:caDSR }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
    }
  }
} order by desc(?count_dec) limit 100

Expected Results: returned 9 rows.

entity identifier preferred_term
http://cbiit.nci.nih.gov/caDSR#DE7847814 7847814 Person Vital Signs Measurement Indicator
http://cbiit.nci.nih.gov/caDSR#DE7847806 7847806 Person Vital Signs Measurement Unit of Measure
http://cbiit.nci.nih.gov/caDSR#DE7572746 7572746 Person Vital Signs Measurement Timepoint Type
http://cbiit.nci.nih.gov/caDSR#DE7572737 7572737 Person Vital Signs Measurement Category
http://cbiit.nci.nih.gov/caDSR#DE7572739 7572739 Person Vital Signs Measurement Value And Unit of Measure Specify Text
http://cbiit.nci.nih.gov/caDSR#DE7847810 7847810 Person Vital Signs Measurement Other Timepoint Specify
http://cbiit.nci.nih.gov/caDSR#DE7572743 7572743 Person Vital Signs Measurement Indicator
http://cbiit.nci.nih.gov/caDSR#DE7847778 7847778 Person Vital Signs Measurement Value Text
http://cbiit.nci.nih.gov/caDSR#DE7572742 7572742 Person Vital Signs Measurement DateTime Value

Text searches use the built-in bif:contains function

Q20 - search for vocabulary concept with text query over all annotations

  • returns IRI, identifier, label, property (IRI), matched text in sparql json
# Q20 - search for vocabulary concept with text, e.g. "gender", query over all annotations

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
prefix bif: <bif:>
select distinct ?entity ?identifier ?label ?property ?value
from <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
where {
  ?entity ?property ?value ;
  ?identifier_property ?identifier ;
  ?preferred_term_property ?label .
  ?value  bif:contains "gender" .
  filter isLiteral (?value)
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:NCIt }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
    }
  }
}
order by ?label, ?identifier

Expected Results: Returned 202 rows. Here are the first 5 rows.

entity identifier label property value
https://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C172486 C172486 ASH Fibrosure Formula http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#P97 A proprietary algorithm derived from the FibroTest liver fibrosis algorithm that is used to measure liver fibrosis, hepatic steatosis, and alcoholic steatohepatitis. It includes ten serum markers: alpha-2-macroglobulin, apolipoprotein A1, total bilirubin, gamma-glutamyltransferase, haptoglobin, alanine aminotransferase, aspartate aminotransferase, glucose, total cholesterol, and triglycerides, and adjusts for age, gender, height, and weight.
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C172486 C172486 ASH Fibrosure Formula http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#P325 A proprietary algorithm derived from the FibroTest liver fibrosis algorithm that is used to measure liver fibrosis, hepatic steatosis, and alcoholic steatohepatitis. It includes ten serum markers: alpha-2-macroglobulin, apolipoprotein A1, total bilirubin, gamma-glutamyltransferase, haptoglobin, alanine aminotransferase, aspartate aminotransferase, glucose, total cholesterol, and triglycerides, and adjusts for age, gender, height, and weight. (NCI)
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C165713 C165713 Achenbach System of Empirically Based Assessment-Adult Self-Report and Adult Behavior Checklist http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#P97 Assessment tools that span the ages 18-59, the Adult Self-Report (ASR) and the Adult Behavior Checklist (ABCL) obtain information from the adult client and from others who know the adult well. Both forms are valuable for assessing adults in a variety of settings, such as mental health, forensic, counseling, medical, and substance abuse. Profiles display scale scores in relation to norms for each gender at ages 18-35 years and 36-59 years. Includes a Critical Items scale, and both forms have parallel scales for Substance Use, Critical Items, Internalizing, Externalizing, and Total Problems.
ncit:C93501 C93501 Administrative Gender Code https://www.w3.org/2000/01/rdf-schema#label Administrative Gender Code
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C93501 C93501 Administrative Gender Code http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#P90 Administrative Gender Code

Q21 - search for vocabulary concept with text query over synonyms

  • returns label, IRI, source's code, in sparql json
# Q21 - search for vocabulary concept with text, e.g. "gender", query over synonyms

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix bif: <bif:>
select distinct ?entity ?identifier ?label ?term
from <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
where {
  ?entity ?term_property  ?term ;
  ?identifier_property ?identifier ;
  ?preferred_term_property ?label .
  ?term  bif:contains "gender" .
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:NCIt }
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasPreferredTerm ?preferred_term_property .
      ?resource srro:hasTerm ?term_property .
    }
  }
}
order by ?identifier
Expected Results: Returned 155 rows. Here are the first 5 rows.
entity identifier label term
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C102709 C102709 Short QTc Interval An electrocardiographic finding of a QT interval corrected for heart rate that is shorter than the lower limit of normal. Thresholds for different age, gender, and patient populations exist. (CDISC)
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C102709 C102709 Short QTc Interval An electrocardiographic finding of a QT interval corrected for heart rate that is shorter than the lower limit of normal. Thresholds for different age, gender, and patient populations exist.
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C105443 C105443 FibroTest Score Measurement A patented biomarker test (APHP, 2001) that measures liver pathology through the assessment of a six-parameter blood test (for alpha-2-macroglobulin, haptoglobin, apolipoprotein A1, gamma-glutamyl transpeptidase, total bilirubin, and alanine aminotransferase), taking into account the age and gender of the patient.
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C105443 C105443 FibroTest Score Measurement A biomarker test that measures liver pathology through the assessment of a six-parameter blood test (for Alpha-2-macroglobulin, Haptoglobin, Apolipoprotein A1, Gamma-glutamyl transpeptidase (GGT), Total bilirubin, and Alanine aminotransferase (ALT)), taking into account the age and gender of the patient.
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C105443 C105443 FibroTest Score Measurement A patented biomarker test (APHP, 2001) that measures liver pathology through the assessment of a six-parameter blood test (for alpha-2-macroglobulin, haptoglobin, apolipoprotein A1, gamma-glutamyl transpeptidase, total bilirubin, and alanine aminotransferase), taking into account the age and gender of the patient.
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C107098 C107098 QTcB Prolongation An electrocardiographic finding in which the QT interval corrected for heart rate using Bazett's formula is prolonged. Thresholds for different age, gender, and patient populations exist.

Q22 - search for the common data elements with a text query over the definition (e.g. all the CDEs that include 'person' in the definition)

  • returns IRI, identifier, matched definition, in sparql json
# Q22 - search for the common data elements with a text, e.g. "gender", query over the definition

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix bif: <bif:>
select distinct ?entity ?identifier ?label ?definition ?term
from <http://cbiit.nci.nih.gov/caDSR>
where {
  ?entity ?definition_property  ?definition ;
  ?preferred_term_property ?label ;
  ?identifier_property ?identifier .
  ?definition  bif:contains "gender" .
  {
    select ?identifier_property ?definition_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:caDSR }
      ?resource srro:hasPreferredTerm ?preferred_term_property .
      ?resource srro:hasIdentifier ?identifier_property .
      ?resource srro:hasDefinition ?definition_property .
    }
  }
}
order by ?identifier

Expected Results: returned 136 rows. Here are the first 5 rows.

entity identifier label definition term
http://cbiit.nci.nih.gov/caDSR#DE12126752 12126752 Study Participant Gender Self-Report Description Gender Type The self-reported description of a study participant's gender.
http://cbiit.nci.nih.gov/caDSR#DE2179640 2179640 Gender Code The code representing the gender of a person.
http://cbiit.nci.nih.gov/caDSR#DE2179641 2179641 Gender Text The text representing the gender of a person.
http://cbiit.nci.nih.gov/caDSR#DE2200604 2200604 Person Gender Text Type Text designations that identify gender. Gender is described as the assemblage of properties that distinguish people on the basis of their societal roles. [Explanatory Comment 1: Identification of gender is based upon self-report and may come from a form, questionnaire, interview, etc.]
http://cbiit.nci.nih.gov/caDSR#DE2222666 2222666 Quality of Life Patient Gender Assessment Category the patient designated gender assignment as part of the QOL assessment.

Q23 - search for common data elements with a text query over the concept labels of concepts in the object class

  • this one doesn't look low-hanging but it is
  • return IRI, identifier, cde label, matched concept label
# Q23 - search for common data elements with a text, e.g. "gender", query over the concept labels of concepts in the object class

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>

select distinct ?entity ?identifier ?label ?concept_label
from <http://cbiit.nci.nih.gov/caDSR>
from <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
where {
  ?entity ?identifier_property ?identifier ;
          ?preferred_term_property ?label ;
          isomdr:Object_Class/(cmdr:main_concept|cmdr:minor_concept) ?concept .
  ?concept ?concept_preferred_term_property ?concept_label .
  ?concept_label  bif:contains "gender" .
  {
    select ?identifier_property ?preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:caDSR }
      ?resource srro:hasPreferredTerm ?preferred_term_property .
      ?resource srro:hasIdentifier ?identifier_property .
    }
  }
  {
    select ?concept_preferred_term_property
    from <http://cbiit.nci.nih.gov/srro>
    where {
      values ?resource {  srro:NCIt }
      ?resource srro:hasPreferredTerm ?concept_preferred_term_property .
    }
  }
}
order by ?identifier

Expected Results: returned 25 rows.

entity identifier label concept_label
http://cbiit.nci.nih.gov/caDSR#DE2222666 2222666 Quality of Life Patient Gender Assessment Category Gender
http://cbiit.nci.nih.gov/caDSR#DE2804676 2804676 With Gender Specimen Information Gender java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE2804686 2804686 With Gender Information Specimen Gender java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE2804690 2804690 With Gender Information Specimen External Identifier java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE2804691 2804691 With Gender Information Specimen Description java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE2804692 2804692 With Gender Information Specimen Name java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE2804693 2804693 With Gender Specimen Information Description java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE2804694 2804694 With Gender Specimen Information Specimen External Identifier java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE2804695 2804695 With Gender Specimen Information Name java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE3005455 3005455 Gender Adjusted Chronic Graft Versus Host Disease Symptom Score Gender
http://cbiit.nci.nih.gov/caDSR#DE3101427 3101427 Gender Created By java.lang.Long Gender
http://cbiit.nci.nih.gov/caDSR#DE3101428 3101428 Gender Created Date java.util.Date Gender
http://cbiit.nci.nih.gov/caDSR#DE3101429 3101429 Gender Change Date java.util.Date Gender
http://cbiit.nci.nih.gov/caDSR#DE3101430 3101430 Gender Description java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE3101431 3101431 Gender Display Name java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE3101432 3101432 Gender Identifier java.lang.Long Gender
http://cbiit.nci.nih.gov/caDSR#DE3101433 3101433 Gender Flag Quantitative java.lang.Boolean Gender
http://cbiit.nci.nih.gov/caDSR#DE3101434 3101434 Gender Modified By java.lang.Long Gender
http://cbiit.nci.nih.gov/caDSR#DE3101435 3101435 Gender Name java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE3101436 3101436 Gender Status java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE3101437 3101437 Gender Value java.lang.String Gender
http://cbiit.nci.nih.gov/caDSR#DE4083137 4083137 Gender Age Ind Gender
http://cbiit.nci.nih.gov/caDSR#DE5700768 5700768 Female Gender Age Confirmation Clinical Trial Eligibility Criteria Status Female Gender
http://cbiit.nci.nih.gov/caDSR#DE5700844 5700844 Female Gender Childbearing Potential Negation Pregnancy Lactating Confirmation Clinical Trial Eligibility Criteria Status Female Gender
http://cbiit.nci.nih.gov/caDSR#DE5722285 5722285 Female Gender Childbearing Potential Non Lactating And Negative Pregnancy Test Confirmation Trial Eligibility Criteria Code Indicator Female Gender

Q24 - find common parent - DSRMWS-3580

# Q24 - find common parent - DSRMWS-3580.

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
SELECT DISTINCT ("SubClassOf Path" AS ?pathType) 
       (CONCAT("INPUT: ", ?inputCCode, " (", ?inputLabel, ") >> REC OC: ", ?comparatorCCode, " (", ?comparatorLabel, ")") AS ?inputAndRecommendedOC)
       ?inputCCode
       ?inputLabel
       ?comparatorCCode
       ?comparatorLabel 
       (CONCAT(?stepStartCCode, " (", ?stepStartLabel, ")") AS  ?stepFrom) 
       (CONCAT(?stepEndCCode, " (", ?stepEndLabel, ")") AS  ?stepTo)  
       ?stepStartCCode
       ?stepStartLabel
       ?stepEndCCode
       ?stepEndLabel
FROM <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
WHERE
  {
    VALUES            ?inputCCode       { "C2985" }
    ?inputIdentifier  ncit:NHC0         ?inputCCode .
    ?inputIdentifier  rdfs:label        ?inputLabel . 
    {
      VALUES                 ?comparatorCCode  { "C27551" }
      ?comparatorIdentifier  ncit:NHC0         ?comparatorCCode .
      ?comparatorIdentifier  rdfs:label        ?comparatorLabel .
      {
        ?inputIdentifier  rdfs:subClassOf* ?stepStart . 
        ?stepStart        rdfs:label       ?stepStartLabel . 
        ?stepStart        ncit:NHC0        ?stepStartCCode . 
        ?stepStart        rdfs:subClassOf  ?stepEnd . 
        ?stepEnd          rdfs:label       ?stepEndLabel . 
        ?stepEnd          ncit:NHC0        ?stepEndCCode . 
        ?stepEnd          rdfs:subClassOf* ?comparatorIdentifier
      }
    }
} limit 100

Expected results: returned 14 rows. Here are the first 3 rows.

pathType inputAndRecommendedOC inputCCode inputLabel comparatorCCode comparatorLabel stepFrom stepTo stepStartCCode stepStartLabel stepEndCCode stepEndLabel
SubClassOf Path INPUT: C2985 (Diabetes Mellitus) >> REC OC: C27551 (Disorder by Site) C2985 Diabetes Mellitus C27551 Disorder by Site C27565 (Non-Neoplastic Endocrine Disorder) C3009 (Endocrine System Disorder) C27565 Non-Neoplastic Endocrine Disorder C3009 Endocrine System Disorder
SubClassOf Path INPUT: C2985 (Diabetes Mellitus) >> REC OC: C27551 (Disorder by Site) C2985 Diabetes Mellitus C27551 Disorder by Site C2985 (Diabetes Mellitus) C171128 (Non-Neoplastic Endocrine Pancreas Disorder) C2985 Diabetes Mellitus C171128 Non-Neoplastic Endocrine Pancreas Disorder
SubClassOf Path INPUT: C2985 (Diabetes Mellitus) >> REC OC: C27551 (Disorder by Site) C2985 Diabetes Mellitus C27551 Disorder by Site C26842 (Pancreatic Disorder) C2990 (Digestive System Disorder) C26842 Pancreatic Disorder C2990

Q25a - find CDE path (1)

# Q25a - find CDE path

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
SELECT ?cde_public_id
       ?cde_preferred_term
       ?cde_main_concept_code
       ?cde_main_concept_name  
FROM <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
WHERE
{
OPTIONAL{ ?oc_concept_identifier  ncit:NHC0   ?cde_main_concept_code  ;
                                  rdfs:label  ?cde_main_concept_name . }
  { SELECT distinct ?cde_public_id ?cde_preferred_term ?oc_concept_identifier #?oc_concept_order   
    FROM <http://cbiit.nci.nih.gov/caDSR>
    WHERE
    {
      VALUES ?cde_public_id { "62" }
      ?cde_identifier ?identifier_property      ?cde_public_id ;
                      ?preferred_term_property  ?cde_preferred_term ;
                      isomdr:Object_Class       ?object_class_identfier .
      ?object_class_identfier  cmdr:main_concept   ?oc_concept_identifier ;     # ncit:C9325
                               cmdr:display_order  ?oc_concept_order .
      {
        SELECT ?identifier_property ?preferred_term_property 
        FROM <http://cbiit.nci.nih.gov/srro>
        WHERE
        {
          VALUES    ?resource              { srro:caDSR }
          ?resource srro:hasIdentifier     ?identifier_property ;
                    srro:hasPreferredTerm  ?preferred_term_property .
        }
      }
    } 
    ORDER BY ?oc_concept_order
    LIMIT 1
  }
} 
LIMIT 100

Expected results: returned 1 row.

cde_public_id cde_preferred_term cde_main_concept_code cde_main_concept_name
62 Patient Gender Category C16960 Patient

Q25b - find CDE path (2)

# Q25b - find CDE path

prefix srro: <http://cbiit.nci.nih.gov/srro#>
prefix isomdr: <http://www.iso.org/11179/MDR#>
prefix cmdr: <http://cbiit.nci.nih.gov/caDSR#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
SELECT DISTINCT ?cde_main_concept_code  #including cde main concept code & name in the select list so this query result can be aligned with the CDE main concept query 
       ?cde_main_concept_name
       ?target_oc_concept_code
       ?target_oc_concept_name
       ?cde_oc_is_a_subclass_of_rec_oc 
FROM <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
WHERE
{
  VALUES                       ?cde_main_concept_code  { "C3242" }
  OPTIONAL{?cde_main_concept_identifier  ncit:NHC0              ?cde_main_concept_code  ;
                                         rdfs:label             ?cde_main_concept_name  . }
  {
    # TEST DATA C2991 - is a parent; C25407 is not a parent
    VALUES                         ?target_oc_concept_code  { "C188021" }
    ?target_oc_concept_identifier  ncit:NHC0                ?target_oc_concept_code ;
                                   rdfs:label               ?target_oc_concept_name .
    OPTIONAL { ?cde_main_concept_identifier rdfs:subClassOf+ ?target_oc_concept_identifier . 
               BIND(true AS ?existence_test_result) 
             } 
    BIND (IF(BOUND(?existence_test_result), "true", "false") AS ?cde_oc_is_a_subclass_of_rec_oc)
  }
} 
LIMIT 100

Expected results: returned 1 row.

cde_main_concept_code cde_main_concept_name target_oc_concept_code target_oc_concept_name cde_oc_is_a_subclass_of_rec_oc
C3242 Multiple Myeloma C188021 B-Cell Malignant Neoplasm true

Q26 - find path between two concepts - DSRMWS-3624

# Q26 - find path between two concepts - DSRMWS-3624

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
SELECT DISTINCT ?inputCCode ?inputLabel ?conceptLabel ?conceptCCode ?parentLabel ?parentCCode
FROM  <http://ncicb.nci.nih.gov/xml/owl/EVS/ThesaurusInf.rdf>
WHERE {
  VALUES                 ?inputCCode       { "C298" } .
  ?inputIdentifier       ncit:NHC0         ?inputCCode .
  ?inputIdentifier       rdfs:label        ?inputLabel .
  ?inputIdentifier       rdfs:subClassOf* ?concept .
  ?concept rdfs:label ?conceptLabel .
  ?concept ncit:NHC0  ?conceptCCode .
  ?concept rdfs:subClassOf ?parent .
  ?parent rdfs:label ?parentLabel .
  ?parent ncit:NHC0  ?parentCCode .

}
LIMIT 100

Expected results: returned 10 rows. Here are the first 3 rows.

inputCCode inputLabel conceptLabel conceptCCode parentLabel parentCCode
C298 BCG Vaccine Pharmacologic Substance C1909 Drug, Food, Chemical or Biomedical Material C1908
C298 BCG Vaccine Biological Agent C307 Pharmacologic Substance C1909
C298 BCG Vaccine Immunotherapeutic Agent C308 Pharmacologic Substance C1909

Q27 - get meta crosswalk - DSRMWS-3681

The Metathesaurus contains mappings from the Meta Concept to other standard terminologies. It can be searched using a concept from an external terminology and then, and if mapped other terminologies, you can retrieve the mapped concept.

# Q27 - get meta crosswalk - DSRMWS-3681

prefix mts: <http://ncim.nci.nih.gov/NCIMetathesaurus#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
select distinct ?Input_code ?Input_source ?Input_code_name ?NCIm_ID ?Mapped_Terminology_Code ?Mapped_Terminology_Source ?Mapped_Terminology_Term
from <http://ncim.nci.nih.gov/NCIMetathesaurus.rdf>
where {   
  bind("MTHU002975" as ?Input_code) . 
  bind("LNC" as ?Input_source)  . 
  bind("NCI" as ?Mapped_Terminology_Source)  .
  ?annotation1 mts:has_code ?Input_code .   
  ?annotation1 mts:has_source ?Input_source .   
  ?annotation2 mts:has_source ?Mapped_Terminology_Source .   
  ?NCIm_ID ?p1 ?annotation1 .   
  ?NCIm_ID ?p2 ?annotation2 .   
  OPTIONAL{?annotation2 mts:has_source ?Mapped_Terminology_Source}.
  OPTIONAL{?annotation2 mts:has_code ?Mapped_Terminology_Code} .
  OPTIONAL{?annotation2 mts:has_term ?Mapped_Terminology_Term} .
  OPTIONAL{?annotation1 mts:has_term ?Input_code_name}
}
GROUP BY ?NCIT_ID

Expected results: returned 1 row.

Input_code Input_source Input_code_name NCIm_ID Mapped_Terminology_Code Mapped_Terminology_Source Mapped_Terminology_Term
MTHU002975 LNC Gender mts:C0079399 C17357 NCI Gender