Modifications to OWLViz - nononing2014/repoProtege GitHub Wiki

OWLViz tool is used for visualization of ontologies currently loaded in Protege. First I will explain directory structure of OWLViz.

  • owlviz\src Contains all source code.
  • owlviz\src\main\java Contain Java source code of OWLViz
  • owlviz\src\main\resources Contains all resources like icons used in UI.
  • owlviz\src\main\java\uk\ac\man\cs\mig\coode Contains code specific to OWLViz
  • owlviz\src\main\java\uk\ac\man\cs\mig\util Contains some utilities provided by external tools and libraries. It is not important for us.
  • owlviz\src\main\java\uk\ac\man\cs\mig\coode\owlviz\apitest Handles testing of current source code when you are building owlviz after some modifications.
  • owlviz\src\main\java\uk\ac\man\cs\mig\coode\owlviz\command Handles different actions corresponding to clicks performed by user in UI.
  • owlviz\src\main\java\uk\ac\man\cs\mig\coode\owlviz\export Save current visualization of ontology in some image format to specified location.
  • owlviz\src\main\java\uk\ac\man\cs\mig\coode\owlviz\model Build actual in memory graph model from ontology. This graph model will later be used by others to display the graph.
  • owlviz\src\main\java\uk\ac\man\cs\mig\coode\owlviz\ui Uses graph model provided by \model and displays it using graphviz.

Among various files present in OWLViz one of interest is AbstractOWLClassGraphModel. It forms base of all other graph models if we include our edges in this model it will be displayed in OWLViz.

AbstractOWLClassGraphModel

You can check its source code after modification here.

Our modifications:

    protected Set<OWLObject> getChildren(OWLObject obj) {
        ::
		for(OWLOntology ont : owlModelManager.getActiveOntologies()){
			children.addAll(ont.getAllOwlClasses((OWLClass)obj));
		}
        ::
    }

       public Object getRelationshipType(Object parentObject, Object childObject) {
		OWLClass parent = (OWLClass)parentObject;
		OWLClass child  = (OWLClass)childObject;
		for(OWLOntology ont : owlModelManager.getActiveOntologies()) {
                if(ont.getEdgeLabelMap(parent).containsKey(child.toStringID())) {
                    return ont.getEdgeLabelMap(parent).get(child.toStringID());
                }
        }
        return " is-a ";
    }

    public int getRelationshipDirection(Object parentObject, Object childObject) {
		OWLClass parent = (OWLClass)parentObject;
		OWLClass child  = (OWLClass)childObject;
		for(OWLOntology ont : owlModelManager.getActiveOntologies()) {
                if(ont.getEdgeLabelMap(parent).containsKey(child.toStringID())) {
                    return GraphModel.DIRECTION_FORWARD;
                }
        }
        return GraphModel.DIRECTION_BACK;
    }

As you can see we are calling our APIs in OWLOntology to introduce edges created using our proposed syntax.

⚠️ **GitHub.com Fallback** ⚠️