Search Mailing List Archives
[protege-discussion] ImageMapWidget and UrlWidget
vendetti at stanford.edu
Mon Mar 12 15:20:45 PDT 2007
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",
KnowledgeBase kb = project.getKnowledgeBase();
Instance instance = kb.getInstance("yourInstanceName");
Slot slot = kb.getSlot("yourSlotName");
String url = (String) instance.getOwnSlotValue(slot);
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.
selma khouri wrote:
> 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