Protégé Plug-in API is a huge program, consists of well-known packages, such as Jena, Xerces, log4j, Junit, etc. If you have no intention of updating the source code, you can pack the sources into jar files for the convenience in the future.


Installation & Getting Started


Download the sources of Protégé-OWL 3.2.1 and Core Protégé and Protégé-Frames 3.2.1
Unzip the files
Copy the sources of Protégé-OWL and Core Protégé to a directory /src.
Protégé-OWL will create directories and files under edu/stanford/smi/protegex
Core Protégé will create directories and files under edu/stanford/smi/protege
Copy the JAR files to /lib. I suggest that copy the Protégé-OWL library first, it includes lots of JAR files. While copy the Core Protégé to /lib will contain a duplicate JAR (junit.jar), ignore it, and copy the other two JAR files (looks.jar and unicode_panel.jar) to the library.
Using Java IDE to create a new project in , add all JAR in the /lib to java classpath, and then compile all .java files, where the .class files will be created in /class.
Make jar files. Change directory to /class and type the following commands:
jar cvf protegex.jar edu/stanford/smi/protegex/*
jar cvf protege.jar edu/stanford/smi/protege/*
Copy the /lib/*.jar, protegex.jar and protege.jar to your working directory .
A Sample Test Program


In your you can write a small test program, such as the following:


package test;
import edu.stanford.smi.protegex.owl.model.OWLModel;




import edu.stanford.smi.protegex.owl.model.OWLNamedClass;




import edu.stanford.smi.protegex.owl.ProtegeOWL;
public class OWLAPIDemoApplication {




public static void
main(String[] args) {




    OWLModel owlModel = ProtegeOWL.createJenaOWLModel();




    owlModel.getNamespaceManager().setDefaultNamespace("http://hello.com#");




    OWLNamedClass worldClass = owlModel.createOWLNamedClass("World");




    System.out.println("Class URI: " + worldClass.getURI());




  }




}
Execute this program stand-alone. The output should be Class URI: http://hello.com#World.

    全站熱搜

    英國旅遊民宿推薦 發表在 痞客邦 留言(0) 人氣()