Ontologies in Prajna

Ontologies provide a formal means of representing the meta-knowledge about a particular topic. With the development of formal ontologies and the Ontology Web Language (OWL), software developers have started to explore the application of ontological reasoning to their problems. Prajna supports ontologies with its ontology reasoners

Loading and Using Ontologies

Prajna supports OWL for ontologies and reasoning. It also supports limited RDF. The ontology components of Prajna are still in development. The ontology and reasoning classes may change as new capabilities are implemented. In addition, as the Semantic Web effort becomes more standardized, and the industry centralizes on standard practices, Prajna will adopt the standards and practices.

Prajna does not support the rigorous level of theoretical ontologies that many other ontology packages (such as Jena) support. Prajna does attempt to provide support for OWL Lite and (most of) OWL DL. However, the Prajna ontology classes attempt to provide more practical approaches to using ontologies.

OWL Ontologies are loaded with the OwlLoader. This class parses the OWL file, and builds the various classes and relationships within the file. It also may build objects, or Things, from definitions within the file.

Once loaded, an ontology can be used to reason additional properties on various objects. This can be particularly useful when the available data is sparse or not well-formed. The ontology can also validate whether an object conforms to the ontology.

Ontology Components

Ontologies consist of several different components. An ontology includes classes, relationships, properties, objects, and other components. Ontologies can be specified in OWL or several other formats.


Ontology classes are roughly analogous to Java classes. They are a common definition of a group of similar objects. They may subclass other classes, or they might be formed from the intersection of two classes. A class can contain values or value limitations for properties and relationships.

In Prajna, the class OwlClass represents a class in an Owl ontology.


Ontology things are analogous to Java objects. They are specific instances of a class, and will usually define specific property values and relationships. Things are essentially collections of triples about a common subject.

In Prajna, the OwlThing class represents a Thing defined in an Owl file.


A property links two concepts together in a triple. The subject is usually a Thing within the ontology. The object is frequently also a thing, but may also be a literal string or value. Properties of an object typically represnt information about that object.

In Prajna, the Property class represents a general property. The OwlObjectProperty class represents a property which links the subject to another Thing, while the OwlDatatypeProperty class references a literal value.

Triples and Queries

Ontologies are built on collections of assertions or facts. These facts are frequently represented in RDF, though other representations are available. A triple is a statement in the form Subject - Predicate (or Property) - Object. For instance, Fido (subject) is a (predicate) dog (object), or Fido (subject) chases (predicate) cars (object).

A query is a special type of triple where one of the three components is unknown. A query can be used to filter a set of triples to identify those which match the query.

In Prajna, the RdfTriple class represents a triple. The triple can be of several types, which indicate how the triple was derived. Most frequently, the triple type is EXPLICIT, indicating that the data was created explicitly. The triple may also be implied by an object's class, by a more specialized relationship, or by other triples. For instance, if we know Fido is a Dog, and Dogs are Mammals, then we can infer that Fido is a Mammal.

Queries can also be represented by the RdfTriple class. One of the three fields is expected to be null, and the TripleType should be set to QUERY. To match the query against other triple, use the matches method.