The core: the most generic queries that apply to every ontology.

  1. Get all the children of a given term.
  2. Get all the parents of a given term.
  3. Google the ontology: search trough all the content on one or more strings.
  4. Search on the names of the terms with one or more strings.
  5. Get all the neighbor terms of a given term.
  6. Get all the properties, like definition, synonyms, etc., of a given term.
  7. Get a list of all the relation types that are used in the ontology.
  8. Get the long list of all the terms in the ontology.
  9. Get the root term(s) of the ontology.
  10. Get the hierarchy to the root for a given term.
  11. Get the hierarchy above a certain term for a given transitive relation type.
  1. Get all the children of a given term.
    
    # Name: get_labeled_children
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Parameter: CCO_U0000000: the term for which the children will be found
    # Function: returns the children of the query-term
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    prefix default_ontology:<http://www.cellcycleontology.org/ontology/rdf/CCO#>
    prefix query_term_id:<http://www.cellcycleontology.org/ontology/rdf/CCO#CCO_U0000000>
    select ?child ?name ?subnamespace
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where {
    ?child default_ontology:is_a query_term_id:.
    ?child rdfs:label ?name.
    ?child rdf:type ?subnamespace.
    }
    			
    		
  2. Get all the parents of a given term.
    
    # Name: get_labeled_parents
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Parameter: CCO_B0000000: the term for which the parents will be found
    # Function: returns the labeled parent terms of CCO_B0000000
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    prefix default_ontology:<http://www.cellcycleontology.org/ontology/rdf/CCO#>
    prefix query_term_id:<http://www.cellcycleontology.org/ontology/rdf/CCO#CCO_B0000000>
    select ?parent ?name ?subnamespace
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where {
    query_term_id: default_ontology:is_a ?parent.
    ?parent rdfs:label ?name.
    ?parent rdf:type ?subnamespace.
    }
    
    			
    		
  3. Google the ontology: search trough all the content on one or more strings.
    
    # Name: search_labeled_terms_on_properties
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Parameter: cell: the first search-string
    # Parameter: activity: the second search-string
    # Function: returns all the labeled terms for which a property -the name, definition, synonym or comment- contains 'cell' and 'activity'
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> 
    prefix default_ontology:<http://www.cellcycleontology.org/ontology/rdf/CCO#>
    select ?term_id ?name ?subnamespace ?term_property ?found_string
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where { 
    filter regex(?found_string, "cell")
    filter regex(?found_string, "activity")?term_id rdfs:label ?name.
    ?term_id rdf:type ?subnamespace.
    {
    ?term_id ?term_property ?found_string.
    ?term_id rdfs:label ?found_string.
    }
    union
    {
    ?term_id ?term_property ?a.
    ?term_id default_ontology:Definition ?a.
    ?a default_ontology:def ?found_string.
    }
    union
    {
    ?term_id ?term_property ?a.
    ?term_id default_ontology:synonym ?a.
    ?a default_ontology:syn ?found_string.
    }
    union
    {
    ?term_id ?term_property ?found_string.
    ?term_id rdfs:comment ?found_string.
    }
    } 
    order by ?term_id
    			
    		
  4. Search on the names of the terms with one or more strings.
    
    # Name: search_labeled_terms_on_name
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Parameter: cell: the first search-string
    # Parameter: activity: the second search-string
    # Function: returns all the labeled terms for which the name contains 'cell' and 'activity'
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> 
    select ?term_id ?name ?subnamespace
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where { 
    ?term_id rdfs:label ?name.
    ?term_id rdf:type ?subnamespace.
    filter regex(?name, "cell")
    filter regex(?name, "activity")
    } 
    
    			
    		
  5. Get all the neighbor terms of a given term.
    
    # Name: get_labeled_neighborhood
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Parameter: CCO_B0002494: the term for which you get the neighboring terms and the relations to them
    # Function: returns the labeled neighborhood of a term
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    prefix query_term_id:<http://www.cellcycleontology.org/ontology/rdf/CCO#CCO_B0002494>
    select ?outward_arrow ?object_neighbour ?object_name ?object_subnamespace ?inward_arrow ?subject_neighbour ?subject_name ?subject_subnamespace
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where {
      {
     query_term_id: ?outward_arrow ?object_neighbour.
      ?object_neighbour rdf:type ?object_subnamespace.
      ?object_neighbour rdfs:label ?object_name.
      }
    union{
      ?subject_neighbour ?inward_arrow query_term_id:.
      ?subject_neighbour rdf:type ?subject_subnamespace.
      ?subject_neighbour rdfs:label ?subject_name.
      }
    }
    			
    		
  6. Get all the properties, like definition, synonyms, etc., of a given term.
    
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Parameter: CCO_B0002268: the term for which you want the properties
    # Function: returns the properties of a given term
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    prefix default_ontology:<http://www.cellcycleontology.org/ontology/rdf/CCO#>
    prefix query_term_id:<http://www.cellcycleontology.org/ontology/rdf/CCO#CCO_B0002268>
    select ?name ?subnamespace ?definition ?dbname_def_xref ?accession_def_xref ?organism ?comment ?synonym ?scope ?dbname_syn_xref ?accession_syn_xref ?dbname_term_xref ?accession_term_xref
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where{
      {query_term_id: rdfs:label ?name}
    union{
      query_term_id: rdf:type ?subnamespace
      }
    union{
      query_term_id: default_ontology:Definition ?a.
        {?a default_ontology:def ?definition.}
      union{
        optional{
          ?a default_ontology:DbXref ?b.
          ?b default_ontology:dbname ?dbname_def_xref.
          ?b default_ontology:acc ?accession_def_xref.
          }
        }
      }  
    union
    {
    query_term_id: default_ontology:belongs_to ?organism_id.
    ?organism_id rdf:type default_ontology:taxon.
    ?organism_id rdfs:label ?organism.
    }
    union
      {query_term_id: rdfs:comment ?comment}
    union{
      query_term_id: default_ontology:synonym ?a.
      ?a default_ontology:syn ?synonym.
      optional{?a default_ontology:scope ?scope.}
      optional{
        ?a default_ontology:DbXref ?b.
        ?b default_ontology:dbname ?dbname_syn_xref.
        ?b default_ontology:acc ?accession_syn_xref.
        }
      }
    union{
      query_term_id: default_ontology:xref ?a.
      ?a default_ontology:dbname ?dbname_term_xref.
      ?a default_ontology:acc ?accession_term_xref.
      }
    }
    
    			
    		
  7. Get a list of all the relation types that are used in the ontology.
    
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Function: returns the relationship types held by the default ontology
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
    select distinct ?relationship_type
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where {
    ?s ?relationship_type ?o.
    ?s rdf:type ?a.
    ?o rdf:type ?b.
    }
    			
    		
  8. Get the long list of all the terms in the ontology.
    
    # Name: get_labeled_ids_of_ontology
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Function: returns all the labeled id's of the queried ontology
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    select ?id ?name ?subnamespace
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where {
    ?id rdf:type ?subnamespace.
    ?id rdfs:label ?name.
    }
    order by ?id
    			
    		
  9. Get the root term(s) of the ontology.
    
    # Name: get_labeled_root_of_ontology
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Function: returns the labeled root of the default ontology (all the terms without parents)
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    prefix default_ontology:<http://www.cellcycleontology.org/ontology/rdf/CCO#>
    select ?root ?name ?subnamespace
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where{
    ?root rdf:type ?subnamespace.
    ?root rdfs:label ?name.
    optional{?root default_ontology:is_a ?b}.
    filter(!bound(?b))
    }
    
    			
    		
  10. Get the hierarchy to the root for a given term.
    
    # Name: get_labeled_hierarchy_to_root
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Parameter: CCO_T0000004: the term for which you will get the hierarchy to the root
    # Function: returns all the possible labeled subsumption paths to the root
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    prefix default_ontology:<http://www.cellcycleontology.org/ontology/rdf/CCO#>
    prefix query_term_id:<http://www.cellcycleontology.org/ontology/rdf/CCO#CCO_T0000004>
    select *
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where {
    optional{
    query_term_id: default_ontology:is_a ?n1 .
    ?n1 rdfs:label ?n1_name.
    ?n1 rdf:type ?n1_subnamespace.
    }
    optional{
    ?n1 default_ontology:is_a ?n2 .
    ?n2 rdfs:label ?n2_name.
    ?n2 rdf:type ?n2_subnamespace.
    }
    optional{
    ?n2 default_ontology:is_a ?n3 .
    ?n3 rdfs:label ?n3_name.
    ?n3 rdf:type ?n3_subnamespace.
    }
    optional{
    ?n3 default_ontology:is_a ?n4 .
    ?n4 rdfs:label ?n4_name.
    ?n4 rdf:type ?n4_subnamespace.
    }
    optional{
    ?n4 default_ontology:is_a ?n5 .
    ?n5 rdfs:label ?n5_name.
    ?n5 rdf:type ?n5_subnamespace.
    }
    optional{
    ?n5 default_ontology:is_a ?n6 .
    ?n6 rdfs:label ?n6_name.
    ?n6 rdf:type ?n6_subnamespace.
    }
    optional{
    ?n6 default_ontology:is_a ?n7 .
    ?n7 rdfs:label ?n7_name.
    ?n7 rdf:type ?n7_subnamespace.
    }
    optional{
    ?n7 default_ontology:is_a ?n8 .
    ?n8 rdfs:label ?n8_name.
    ?n8 rdf:type ?n8_subnamespace.
    }
    optional{
    ?n8 default_ontology:is_a ?n9 .
    ?n9 rdfs:label ?n9_name.
    ?n9 rdf:type ?n9_subnamespace.
    }
    optional{
    ?n9 default_ontology:is_a ?n10 .
    ?n10 rdfs:label ?n10_name.
    ?n10 rdf:type ?n10_subnamespace.
    }
    optional{
    ?n10 default_ontology:is_a ?n11 .
    ?n11 rdfs:label ?n11_name.
    ?n11 rdf:type ?n11_subnamespace.
    }
    optional{
    ?n11 default_ontology:is_a ?n12 .
    ?n12 rdfs:label ?n12_name.
    ?n12 rdf:type ?n12_subnamespace.
    }
    optional{
    ?n12 default_ontology:is_a ?n13 .
    ?n13 rdfs:label ?n13_name.
    ?n13 rdf:type ?n13_subnamespace.
    }
    optional{
    ?n13 default_ontology:is_a ?n14 .
    ?n14 rdfs:label ?n14_name.
    ?n14 rdf:type ?n14_subnamespace.
    }
    optional{
    ?n14 default_ontology:is_a ?n15 .
    ?n15 rdfs:label ?n15_name.
    ?n15 rdf:type ?n15_subnamespace.
    }
    optional{
    ?n15 default_ontology:is_a ?n16 .
    ?n16 rdfs:label ?n16_name.
    ?n16 rdf:type ?n16_subnamespace.
    }
    optional{
    ?n16 default_ontology:is_a ?n17 .
    ?n17 rdfs:label ?n17_name.
    ?n17 rdf:type ?n17_subnamespace.
    }
    optional{
    ?n17 default_ontology:is_a ?n18 .
    ?n18 rdfs:label ?n18_name.
    ?n18 rdf:type ?n18_subnamespace.
    }
    optional{
    ?n18 default_ontology:is_a ?n19 .
    ?n19 rdfs:label ?n19_name.
    ?n19 rdf:type ?n19_subnamespace.
    }
    optional{
    ?n19 default_ontology:is_a ?n20 .
    ?n20 rdfs:label ?n20_name.
    ?n20 rdf:type ?n20_subnamespace.
    }
    optional{
    ?n20 default_ontology:is_a ?n21 .
    ?n21 rdfs:label ?n21_name.
    ?n21 rdf:type ?n21_subnamespace.
    }
    optional{
    ?n21 default_ontology:is_a ?n22 .
    ?n22 rdfs:label ?n22_name.
    ?n22 rdf:type ?n22_subnamespace.
    }
    optional{
    ?n22 default_ontology:is_a ?n23 .
    ?n23 rdfs:label ?n23_name.
    ?n23 rdf:type ?n23_subnamespace.
    }
    optional{
    ?n23 default_ontology:is_a ?n24 .
    ?n24 rdfs:label ?n24_name.
    ?n24 rdf:type ?n24_subnamespace.
    }
    optional{
    ?n24 default_ontology:is_a ?n25 .
    ?n25 rdfs:label ?n25_name.
    ?n25 rdf:type ?n25_subnamespace.
    }
    optional{
    ?n25 default_ontology:is_a ?n26 .
    ?n26 rdfs:label ?n26_name.
    ?n26 rdf:type ?n26_subnamespace.
    }
    optional{
    ?n26 default_ontology:is_a ?n27 .
    ?n27 rdfs:label ?n27_name.
    ?n27 rdf:type ?n27_subnamespace.
    }
    optional{
    ?n27 default_ontology:is_a ?n28 .
    ?n28 rdfs:label ?n28_name.
    ?n28 rdf:type ?n28_subnamespace.
    }
    optional{
    ?n28 default_ontology:is_a ?n29 .
    ?n29 rdfs:label ?n29_name.
    ?n29 rdf:type ?n29_subnamespace.
    }
    optional{
    ?n29 default_ontology:is_a ?n30 .
    ?n30 rdfs:label ?n30_name.
    ?n30 rdf:type ?n30_subnamespace.
    }
    optional{
    ?n30 default_ontology:is_a ?n31 .
    ?n31 rdfs:label ?n31_name.
    ?n31 rdf:type ?n31_subnamespace.
    }
    optional{
    ?n31 default_ontology:is_a ?n32 .
    ?n32 rdfs:label ?n32_name.
    ?n32 rdf:type ?n32_subnamespace.
    }
    optional{
    ?n32 default_ontology:is_a ?n33 .
    ?n33 rdfs:label ?n33_name.
    ?n33 rdf:type ?n33_subnamespace.
    }
    optional{
    ?n33 default_ontology:is_a ?n34 .
    ?n34 rdfs:label ?n34_name.
    ?n34 rdf:type ?n34_subnamespace.
    }
    optional{
    ?n34 default_ontology:is_a ?n35 .
    ?n35 rdfs:label ?n35_name.
    ?n35 rdf:type ?n35_subnamespace.
    }
    optional{
    ?n35 default_ontology:is_a ?n36 .
    ?n36 rdfs:label ?n36_name.
    ?n36 rdf:type ?n36_subnamespace.
    }
    optional{
    ?n36 default_ontology:is_a ?n37 .
    ?n37 rdfs:label ?n37_name.
    ?n37 rdf:type ?n37_subnamespace.
    }
    }
    
    			
    		
  11. Get the hierarchy above a certain term for a given transitive relation type.
    
    # Name: get_labeled_hierarchy_by_relation_type
    # Parameter: http://www.cellcycleontology.org/ontology/rdf/CCO: the default ontology URI
    # Parameter: CCO_P0000192: the term for which you will get the hierarchy to the root
    # Parameter: part_of: the transitive relation type along which you want the upstream hierarchy
    # Function: returns all the possible labeled upstream paths for a given term and a given relation type
    prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    prefix default_ontology:<http://www.cellcycleontology.org/ontology/rdf/CCO#>
    prefix query_relation_id:<http://www.cellcycleontology.org/ontology/rdf/CCO#part_of>
    prefix query_term_id:<http://www.cellcycleontology.org/ontology/rdf/CCO#CCO_P0000192>
    select *
    from <http://www.cellcycleontology.org/ontology/rdf/CCO>
    where {
    optional{
    query_term_id: query_relation_id: ?n1 .
    ?n1 rdfs:label ?n1_name.
    ?n1 rdf:type ?n1_subnamespace.
    }
    optional{
    ?n1 query_relation_id: ?n2 .
    ?n2 rdfs:label ?n2_name.
    ?n2 rdf:type ?n2_subnamespace.
    }
    optional{
    ?n2 query_relation_id: ?n3 .
    ?n3 rdfs:label ?n3_name.
    ?n3 rdf:type ?n3_subnamespace.
    }
    optional{
    ?n3 query_relation_id: ?n4 .
    ?n4 rdfs:label ?n4_name.
    ?n4 rdf:type ?n4_subnamespace.
    }
    optional{
    ?n4 query_relation_id: ?n5 .
    ?n5 rdfs:label ?n5_name.
    ?n5 rdf:type ?n5_subnamespace.
    }
    optional{
    ?n5 query_relation_id: ?n6 .
    ?n6 rdfs:label ?n6_name.
    ?n6 rdf:type ?n6_subnamespace.
    }
    optional{
    ?n6 query_relation_id: ?n7 .
    ?n7 rdfs:label ?n7_name.
    ?n7 rdf:type ?n7_subnamespace.
    }
    optional{
    ?n7 query_relation_id: ?n8 .
    ?n8 rdfs:label ?n8_name.
    ?n8 rdf:type ?n8_subnamespace.
    }
    optional{
    ?n8 query_relation_id: ?n9 .
    ?n9 rdfs:label ?n9_name.
    ?n9 rdf:type ?n9_subnamespace.
    }
    optional{
    ?n9 query_relation_id: ?n10 .
    ?n10 rdfs:label ?n10_name.
    ?n10 rdf:type ?n10_subnamespace.
    }
    optional{
    ?n10 query_relation_id: ?n11 .
    ?n11 rdfs:label ?n11_name.
    ?n11 rdf:type ?n11_subnamespace.
    }
    optional{
    ?n11 query_relation_id: ?n12 .
    ?n12 rdfs:label ?n12_name.
    ?n12 rdf:type ?n12_subnamespace.
    }
    optional{
    ?n12 query_relation_id: ?n13 .
    ?n13 rdfs:label ?n13_name.
    ?n13 rdf:type ?n13_subnamespace.
    }
    optional{
    ?n13 query_relation_id: ?n14 .
    ?n14 rdfs:label ?n14_name.
    ?n14 rdf:type ?n14_subnamespace.
    }
    optional{
    ?n14 query_relation_id: ?n15 .
    ?n15 rdfs:label ?n15_name.
    ?n15 rdf:type ?n15_subnamespace.
    }
    optional{
    ?n15 query_relation_id: ?n16 .
    ?n16 rdfs:label ?n16_name.
    ?n16 rdf:type ?n16_subnamespace.
    }
    optional{
    ?n16 query_relation_id: ?n17 .
    ?n17 rdfs:label ?n17_name.
    ?n17 rdf:type ?n17_subnamespace.
    }
    optional{
    ?n17 query_relation_id: ?n18 .
    ?n18 rdfs:label ?n18_name.
    ?n18 rdf:type ?n18_subnamespace.
    }
    optional{
    ?n18 query_relation_id: ?n19 .
    ?n19 rdfs:label ?n19_name.
    ?n19 rdf:type ?n19_subnamespace.
    }
    optional{
    ?n19 query_relation_id: ?n20 .
    ?n20 rdfs:label ?n20_name.
    ?n20 rdf:type ?n20_subnamespace.
    }
    optional{
    ?n20 query_relation_id: ?n21 .
    ?n21 rdfs:label ?n21_name.
    ?n21 rdf:type ?n21_subnamespace.
    }
    optional{
    ?n21 query_relation_id: ?n22 .
    ?n22 rdfs:label ?n22_name.
    ?n22 rdf:type ?n22_subnamespace.
    }
    optional{
    ?n22 query_relation_id: ?n23 .
    ?n23 rdfs:label ?n23_name.
    ?n23 rdf:type ?n23_subnamespace.
    }
    optional{
    ?n23 query_relation_id: ?n24 .
    ?n24 rdfs:label ?n24_name.
    ?n24 rdf:type ?n24_subnamespace.
    }
    optional{
    ?n24 query_relation_id: ?n25 .
    ?n25 rdfs:label ?n25_name.
    ?n25 rdf:type ?n25_subnamespace.
    }
    optional{
    ?n25 query_relation_id: ?n26 .
    ?n26 rdfs:label ?n26_name.
    ?n26 rdf:type ?n26_subnamespace.
    }
    optional{
    ?n26 query_relation_id: ?n27 .
    ?n27 rdfs:label ?n27_name.
    ?n27 rdf:type ?n27_subnamespace.
    }
    optional{
    ?n27 query_relation_id: ?n28 .
    ?n28 rdfs:label ?n28_name.
    ?n28 rdf:type ?n28_subnamespace.
    }
    optional{
    ?n28 query_relation_id: ?n29 .
    ?n29 rdfs:label ?n29_name.
    ?n29 rdf:type ?n29_subnamespace.
    }
    optional{
    ?n29 query_relation_id: ?n30 .
    ?n30 rdfs:label ?n30_name.
    ?n30 rdf:type ?n30_subnamespace.
    }
    optional{
    ?n30 query_relation_id: ?n31 .
    ?n31 rdfs:label ?n31_name.
    ?n31 rdf:type ?n31_subnamespace.
    }
    optional{
    ?n31 query_relation_id: ?n32 .
    ?n32 rdfs:label ?n32_name.
    ?n32 rdf:type ?n32_subnamespace.
    }
    optional{
    ?n32 query_relation_id: ?n33 .
    ?n33 rdfs:label ?n33_name.
    ?n33 rdf:type ?n33_subnamespace.
    }
    optional{
    ?n33 query_relation_id: ?n34 .
    ?n34 rdfs:label ?n34_name.
    ?n34 rdf:type ?n34_subnamespace.
    }
    optional{
    ?n34 query_relation_id: ?n35 .
    ?n35 rdfs:label ?n35_name.
    ?n35 rdf:type ?n35_subnamespace.
    }
    optional{
    ?n35 query_relation_id: ?n36 .
    ?n36 rdfs:label ?n36_name.
    ?n36 rdf:type ?n36_subnamespace.
    }
    optional{
    ?n36 query_relation_id: ?n37 .
    ?n37 rdfs:label ?n37_name.
    ?n37 rdf:type ?n37_subnamespace.
    }
    }