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] method for adding xml:comment strings to OWL classes

Thomas Russ tar at isi.edu
Thu Jul 8 09:35:51 PDT 2010


On Jul 7, 2010, at 7:18 PM, Patrice Seyed wrote:

> Hi,
>
> Is there a method (using either Protege-OWL or OWL2 APIs) for adding
> to an rdfs:comment string to an owl:Class definition? (I have a
> lengthy file of tab separated terms and definitions that I'm trying to
> get into an OWL format.) Did not find anything immediately useful in
> the respective javadocs.

Sure.  The rdfs:comment property is simply an property like any  
other.  So you can use the standard API calls for adding Property  
values to objects.

In the Protege-OWL API, you want to take a look at the RDFResource and  
RDFProperty classes.  You can use the OWLModel.getRDFResource and  
OWLModel.getRDFProperty to get the object and the property.  Then use  
RDFResource.addPropertyValue to add the new comment.

Untested, but I think something like this should work:

    OWLModel model = ...
    RDFResource target = model.getRDFResource(myResourceName);
    RDFProperty comment = model.getRDFProperty("rdfs:comment");
    target.addPropertyValue(comment, "Here is my comment text");

Hmmm, looking further, it seems that there is an even simpler method,  
namely to use

     OWLUtil.addComment(resource, commentText);

You do still need to get the resource for the objet that you want to  
attach the comment to.


You could do something similar using the OWL2 API, although the  
procedure would be different.  I would start by looking at http://owlapi.sourceforge.net/documentation.html



  
   



More information about the protege-owl mailing list