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.
http://visallo.org#conceptTypeproperty. Examples of classes are person, organization, document.
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.
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
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.
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 . 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 . 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.
repository.ontology=org.visallo.vertexium.model.ontology.InMemoryOntologyRepository repository.ontology.owl.simple.iri=http://yourdomain.com/simple repository.ontology.owl.simple.file=/home/jferner/dev/ontology-simple/simple.owl
Now when you start Visallo and create an entity you should see your new employee and organization classes.