Class Ontology

java.lang.Object
net.simplace.sim.util.ontology.Ontology

public class Ontology extends Object
Access to the OM ontology (Ontology of units of Measure, version 1.8), used to resolve unit URIs of variables into names, symbols and descriptions.

The ontology is read from OM_18.rdf on the classpath or, if missing, from http://simplace.net/dtd/OM_18.rdf. If it cannot be read, the ontology is inactive and the methods return the last part of the URI instead.

The home page of the OM ontology is: http://www.wurvoc.org/vocabularies/om-1.8/

Author:
Andreas Enders, Crop Science Group, Katzenburgweg 5, 53115 Bonn, Germany IMPETUS Project, www.impetus.uni-koeln.de Contact Information: info@andreas-enders.de
  • Method Details

    • getInstance

      public static Ontology getInstance()
      Returns the singleton instance; the ontology is read on the first call.
      Returns:
      the ontology
    • main

      public static void main(String[] args)
      Test: prints the symbol and all properties of the unit metre.
      Parameters:
      args - not used
    • getProperty

      public String getProperty(String aURI, org.apache.jena.rdf.model.Property aProperty, boolean aCheckForLang)
      Returns the value of a property of an ontology resource. If the ontology is inactive or the resource has no such property, the last part of the URI is returned (a warning is logged in the second case).
      Parameters:
      aURI - URI of the resource (e.g. a unit)
      aProperty - the property to read
      aCheckForLang - true to return the English (en) value (the first value if there is no English one), false for the first value
      Returns:
      the property value
    • getStandardName

      public String getStandardName(String aURI)
      Returns the English label (rdfs:label) of a unit.
      Parameters:
      aURI - URI of the unit
      Returns:
      the name of the unit, see getProperty(String, Property, boolean)
    • getSymbol

      public String getSymbol(String aURI)
      Returns the symbol (om:symbol) of a unit.
      Parameters:
      aURI - URI of the unit
      Returns:
      the symbol of the unit, see getProperty(String, Property, boolean)
    • getDescription

      public String getDescription(String aURI)
      Returns the definition (om:definition) of a unit.
      Parameters:
      aURI - URI of the unit
      Returns:
      the definition, or the last part of the URI if the ontology is inactive or the unit has no definition
    • allInstances

      public List<org.apache.jena.rdf.model.Statement> allInstances(String aURI)
      Returns all statements (properties) of an ontology resource.
      Parameters:
      aURI - URI of the resource
      Returns:
      all statements with the resource as subject; empty if the ontology is inactive