Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Using PROMPT from own application

Sean Falconer falconer.sean at
Tue Apr 13 08:48:56 PDT 2010

You can programmatically use Prompt. You'll need to have Protege,
Protege-OWL, and the Prompt jar files in your classpath. To my
knowledge there isn't a lot of documentation on the Prompt API, so you
may need to download the source and dig through it to figure some
things out.  I included some code below to get you started. It sets up
and runs the Prompt mapping algorithm for two ontologies loaded using
the Protege API.  The code is a bit long as Prompt was never really
designed to be used this way.

// the sourceProject and targetProject are the path locations for the pprj files
public void createMapping(String sourceProject, String targetProject) {
     // load the ontologies using the Protege API
     KnowledgeBase sourceKb = loadOntology(sourceProject);
     KnowledgeBase targetKb = loadOntology(targetProject);
     String sourceProject = sourceKb.getProject().getProjectURI().getPath();
     String targetProject = targetKb.getProject().getProjectURI().getPath();	

     // have to tell Protege what the current project is since we are
bypassing the UI
false, true);
     // configure Prompt
     // we set the comparison plugin to null to make Prompt use the default					

     // setup how the mappings will be stored    	
     LinkedList listOfStorageOptions =
     MappingStoragePluginOrder.putSimplePluginFirst (listOfStorageOptions);
     Collection storagePlugins = new ArrayList();
     // set the active storage plugin	    		
     // force Prompt to initialize				
     new PromptTab();
     if(targetProject.charAt(0) == '/') targetProject =
     if(sourceProject.charAt(0) == '/') sourceProject =
     String[] projectFiles = new String[] {targetProject, "", "",
     String[] projectNames = new String[]
{getProjectName(targetProject), "", "",
    // add a listener so we know when the mapping is complete
    PromptListenerManager.addListener(new PromptAdapter() {
						public void taskComplete(PromptEvent event, boolean interrupted) {
							if(!interrupted) {
								// mapping complete! do something
     PromptTab.setUpMerging(projectFiles, projectNames, -1, true);

private String getProjectName(String projectPath) {
		int start = projectPath.lastIndexOf(File.separatorChar)+1;
		int end = projectPath.lastIndexOf(".");
		if(start >= 0 && end >= 0) {
			return projectPath.substring(start, end);
		return "";

private KnowledgeBase loadOntology(String projectFile) {
		if (projectFile != null) {
			if(projectFile.endsWith(".pprj")) {
				try {
					Collection<Object> errors = new ArrayList<Object>(0);
					Project project =
					return project.getKnowledgeBase();
				} catch (Exception ex) {

		return null;

On Tue, Apr 13, 2010 at 6:48 AM, Maria Mitina <mitina.maria at> wrote:
> Hi everyone,
> i am new to Protege and feeling a bit lost regarding
> the use of plugins.
> In my task i need to compare two ontologies from my own
> application in java.
> I found out that the results of comparosin by PROMPT are
> very close to what i
> need. But i cannot find any information on how to access
> PROMPT from my programme.
> Do i need to use Protege-OWL API? Or is there the way to
> access PROMPT directly
> from java application sourcing pathes to my ontologies only?
> If someone has experience of accessing PROMPT (or using a
> similar tool to
> compare ontologies) from their own programme, please, share
> it! I would really
> appreciate this!
> Thank everyone,
> Maria.
> _______________________________________________
> protege-owl mailing list
> protege-owl at
> Instructions for unsubscribing:

Sean Falconer, PhD
Postdoctoral Researcher
Stanford Center for Biomedical Informatics Research

More information about the protege-owl mailing list