facebook pixel image Creating an Ontology

Creating an Ontology

Visallo requires an ontology to work. The ontology drives how searches are performed, how data is saved, and how the users interact with that data. So it’s crucial to get the ontology right before you create lots of data or tools to import data. This post is going to walk through the basics of creating an ontology using Protégé.

When Visallo starts for the first time it reads the ontology represented in OWL files. OWL files are XML files describing the types of objects, the properties on those objects, and the relationships that objects can have with other objects. Ontologies and OWL files have a different vocabulary that most people will not be familiar with, here is a list of just a few and what they mean to Visallo.

  • IRI - IRIs look like URIs and serve as unique identifiers for classes, properties, and relationships.
  • Class - Similar to a class in java, classes describe an object. In Visallo every vertex or node on the graph is assigned a class via the http://visallo.org#conceptType property. Examples of classes are person, organization, document.
  • Datatype Property - Properties or attributes of a class. Datatype properties can belong to many classes but can only have one type. Examples of datatype properties are birth date, gender, amount.
  • Object Property - Relationships or edges a class can have with another class. Object properties can have many possible source classes and destination classes. Examples of object properties are employs, parent of, sibling.
  • Domain - For datatype properties, the domains describe which classes the property can belong to. For object proprties the domain describes the out side of the relationship. For example, if a person has a phone, the person class is the domain of the “has” object property.
  • Range - For datatype properties, the range describes the type of the property (eg. string, integer). For object properties the range represents the in side of the relationship. Using the person has a phone example the phone class would be the range of the “has” object property.
  • Label - This is the display value of the class, property, or relationship. The label is what is displayed on the UI.

Visallo has extended the OWL format to include some additional attributes. These attributes can help the system determine how to index the values, how the user interacts with those object, etc. For a list of these you can look at the Visallo ontology documentation.

Now that we have the terminology out of the way, lets create a simple ontology.
Visallo Ontology

To get us started with our OWL file we’ll copy an existing OWL file from the Visallo project. The minimal.owl file contains some classes, properties, and relationships required by Visallo. Create a new directory and move all the files from the minimal.owl’s directory then rename minimal.owl to simple.owl. The newly renamed simple.owl file has many IRIs with visallo and minimal in the name. We can change all of these to our custom IRI if you would like. Open simple.owl in an editor and replace all http://visallo.org/minimal with http://yourdomain.com/simple.

Now lets open simple.owl in Protégé. To do this we first have to open Visallo’s base.owl to tell Protégé about Visallo’s custom extensions to the OWL format. After that we can open our simple.owl file. When prompted to open in the same window answer yes, this will allow our simple.owl to reference the already loaded base.owl file. Protégé should now look like this.
Visallo and Protege

Next lets add our employee and organization classes. To do this we click the entities tab. Expanding the class hierarchy we’ll see the Visallo required classes raw, audio, document, image, and video. Our employee and organization classes will both use a parent of thing. Click thing, then click the add subclass button. Type “employee” in the name field and click OK. We also need a display name, to add the display name to employee, click employee, then click the “+” next to annotations and select “rdfs:label” and type in a display name such as “Employee”. Repeat the process for “organization”.

Now lets add the “employs” relationship. To do this click the “object property hierarchy” tab in the bottom left part of the interface. This will bring of the hierarchy of relationships. Click the “owl:topObjectProperty”, then the add subproperty button Visallo protege add subproperty button in protege. Type “employs” in the name field and click OK. To hook up the “employs” relationships with our employee and organization we’ll need to add the domain and range. Click the “employs” relationship then click the “+” next to domain, find “organization” in the hierarchy and click OK. Then click the “+” next to range and do the same for “employee”.

Finally lets add some properties to our organization and employee classes. To do this click the “data property hierarchy” tab in the bottom left part of the interface. Click the “owl:topObjectProperty”, then the add subproperty button Protege subproperty button. Type “name” in the name field and click OK. To attach the property to both our employee and organization click the “+” next to domain, find and add “organization”. Then repeat for “employee”. Finally we’ll want to assign a type to name. Click the “+” next to range, click the “Built in datatypes” tab and find “string” and click OK.

At this point our simple ontology is ready to try out in Visallo. We need to tell Visallo about it. While developing an ontology it is also nice to use the in memory ontology so we iterate over the changes faster. Add the following lines to the end of your visallo.properties file.


Now when you start Visallo and create an entity you should see your new employee and organization classes.

Visallo with simple.owl loaded