Tree Numbers

MeSH descriptors are organized into 16 categories, each of which is further divided into sub-categories to assist in more specific classification of a descriptor. These hierarchical categories and subcategories are identified by MeSH tree numbers. A given MeSH descriptor often has more than one tree number assigned to it, meaning that it fits into the category hierarchies in multiple places.

In MeSH RDF, tree numbers are both classes in their own right (meshv:TreeNumber), as well as properties of a meshv:Descriptor, via the meshv:treeNumber predicate. meshv:TreeNumber classes are related to each other via the meshv:parentTreeNumber relationship. In order to discover ancestors or descendants of a meshv:Descriptor according to these hierarchies, one could use the ‘+’ operator on the meshv:parentTreeNumber property. (See the Sample Queries page for examples).

More information about MeSH Tree Numbers is available in the MeSH documentation, MeSH Tree Structures.

RDF Graph Diagram

In this particular example, ‘Eye’ belongs to both the ‘Body Regions’ tree (A01) and the ‘Sense Organs’ tree (A09).

Tree Numbers Produce Overlapping Hierarchies

To account for the fact that MeSH Descriptors can belong to multiple trees, MeSH RDF represents tree numbers as a proper class called meshv:TreeNumber. As mentioned earlier, users can leverage the “meshv:parentTreeNumber+” construct to walk up and down the trees to which MeSH descriptors belong. For example, this query retrieves all ancestors of ‘Eyebrows’. Note, in particular, that the results do not include D012679, Sense Organs (which a naive query using the meshv:broaderDescriptor property would.)

Tree Numbers RDF Graph Model

PREFIX mesh: <http://id.nlm.nih.gov/mesh/>
PREFIX meshv: <http://id.nlm.nih.gov/mesh/vocab#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?treeNode ?ancestor ?alabel
FROM <http://id.nlm.nih.gov/mesh2014>

WHERE {
  mesh:D005138 meshv:treeNumber ?treeNode .
  ?treeNode meshv:parentTreeNumber+ ?ancestorTreeNode .
  ?ancestor meshv:treeNumber ?ancestorTreeNode .
  ?ancestor rdfs:label ?alabel
}

ORDER BY ?treeNode

meshv:TreeNumber - Relations and Properties

Subject Predicate Object
meshv:TreeNumber meshv:parentTreeNumber meshv:TreeNumber
Subject Predicate Object
meshv:Descriptor meshv:treeNumber meshv:TreeNumber
meshv:GeographicalDescriptor meshv:treeNumber meshv:TreeNumber
meshv:PublicationType meshv:treeNumber meshv:TreeNumber
meshv:Qualifier meshv:allowedTreeNode meshv:TreeNumber
meshv:Qualifier meshv:treeNumber meshv:TreeNumber
meshv:TopicalDescriptor meshv:treeNumber meshv:TreeNumber
meshv:TreeNumber meshv:parentTreeNumber meshv:TreeNumber
Subject Predicate
meshv:TreeNumber meshv:active
meshv:TreeNumber meshv:lastActiveYear
meshv:TreeNumber rdfs:label

SPARQL

Users can also discover immediate narrower/broader meshv:Descriptors via the meshv:parentTreeNumber predicate. The following SPARQL query creates a table that shows the relationships between “Eye” and each of the immediate broader and narrower concepts for each of its tree numbers:

PREFIX mesh: <http://id.nlm.nih.gov/mesh/>
PREFIX meshv: <http://id.nlm.nih.gov/mesh/vocab#>

SELECT *
FROM <http://id.nlm.nih.gov/mesh>
WHERE {
 mesh:D005123 meshv:treeNumber ?tree_number .

  {
    SELECT ?tree_number
           ?broader_tree_number ?broader_descriptor
           ?narrower_tree_number ?narrower_descriptor
    WHERE {
      ?tree_number meshv:parentTreeNumber ?broader_tree_number .
      ?broader_descriptor meshv:treeNumber ?broader_tree_number .
      mesh:D005123 meshv:broaderDescriptor ?broader_descriptor .

      ?narrower_tree_number meshv:parentTreeNumber ?tree_number .
      ?narrower_descriptor meshv:treeNumber ?narrower_tree_number .
      ?narrower_descriptor meshv:broaderDescriptor mesh:D005123 .
    }
  }
}

The SPARQL query below outputs the RDF graph of the previous query, using the CONSTRUCT clause.

PREFIX mesh: <http://id.nlm.nih.gov/mesh/>
PREFIX meshv: <http://id.nlm.nih.gov/mesh/vocab#>

CONSTRUCT {
  mesh:D005123 meshv:treeNumber ?tree_number .
  ?tree_number meshv:parentTreeNumber ?broader_tree_number .
  ?broader_descriptor meshv:treeNumber ?broader_tree_number .
  mesh:D005123 meshv:broaderDescriptor ?broader_descriptor .

  ?narrower_tree_number meshv:parentTreeNumber ?tree_number .
  ?narrower_descriptor meshv:treeNumber ?narrower_tree_number .
  ?narrower_descriptor meshv:broaderDescriptor mesh:D005123 .
}
from <http://id.nlm.nih.gov/mesh>
where {
  mesh:D005123 meshv:treeNumber ?tree_number .

  {
    select ?tree_number
           ?broader_tree_number ?broader_descriptor
           ?narrower_tree_number ?narrower_descriptor
    where {
      ?tree_number meshv:parentTreeNumber ?broader_tree_number .
      ?broader_descriptor meshv:treeNumber ?broader_tree_number .
      mesh:D005123 meshv:broaderDescriptor ?broader_descriptor .

      ?narrower_tree_number meshv:parentTreeNumber ?tree_number .
      ?narrower_descriptor meshv:treeNumber ?narrower_tree_number .
      ?narrower_descriptor meshv:broaderDescriptor mesh:D005123 .
    }
  }
}