-
Notifications
You must be signed in to change notification settings - Fork 1
Behaviors
mwarnock edited this page Sep 12, 2010
·
5 revisions
Behaviors are a means to extend traditional ruby classes/objects with ontological information.
The ontology behavior uses a specified attribute of a class (default is name) as an ontology term. A query is made to find all the relationships of the ontology term contained within a triple store. These are accessed via the ontology method on an instance of a class.
This example is based on some terms in the Radlex 2.0 ontology.
require 'active_sesame' class OntologyTest attr_accessor :owl_term ActiveSesame::Behaviors::Ontology.mimic(self) end ot = OntologyTerm.new ot.owl_term = "http://www.owl-ontologies.com/Ontology1241733063#RID3436" ot.ontology #Builds a ActiveSesame::Ontology::Term for the value of owl_term ot.ontology.relationships ot.ontology.Preferred_Name.term #Looks up relationships and returns the Ontology::Term for its value ot.ontology.Is_A ot.ontology.Is_A.Preferred_Name end