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-discussion] ImageMapWidget and UrlWidget

Jennifer Vendetti vendetti at stanford.edu
Mon Mar 12 15:20:45 PDT 2007


Selma,

If you have a slot that has been associated with the ImageWidget or the 
URLWidget, the return value from instance.getOwnSlotValue(slot) will be 
a string, which will be the path to the image or the text of the URL 
respectively.  The following code will print the slot value of a slot 
that uses the URLWidget:

Collection errors = new ArrayList();
Project project = new Project(pathToYourProject, errors);
ProjectManager.getProjectManager().displayErrors("Load Project Errors", 
errors);

KnowledgeBase kb = project.getKnowledgeBase();
Instance instance = kb.getInstance("yourInstanceName");
Slot slot = kb.getSlot("yourSlotName");
String url = (String) instance.getOwnSlotValue(slot);
System.out.println(url);

Once you have retrieved the path to an image, you can use standard Java 
code to create an image object.  Same for a URL object.

Jennifer

selma khouri wrote:
> Hi,
> I'm working with image with ImageMapWidget, I want to know how I can 
> access the image which I stored in Protégé from a java application.
> I have  the same problem with the URL Widget. the web page appears in 
> the InstanceTab of Protege but I don't know how to access it from a 
> java application (I tried with instance.getOwnSlotValue(slot) but the 
> result of this instruction is null).
> thank you for your help.



More information about the protege-discussion mailing list