Re: How to handle predicates and anonymous inferred classes created in protege via JENA?

Hi,

Discussion at the end...

On Mon, Jun 21, 2010 at 2:54 PM, mihir sanghavi <ms478@njit.edu> wrote:
> ---------- Forwarded message ----------
> From: <fa2260@columbia.edu>
> Date: Mon, Jun 21, 2010 at 5:38 PM
> Subject: Re: How to handle predicates and anonymous inferred classes created
> in protege via JENA?
> To: mihir sanghavi <ms478@njit.edu>
>
>
> Hey Folks,
>
> I am developing a semantic web application that helps navigate biological
> hierarchies. The ontology is modelled in protege. I am having problems
> parsing the Protege generated .owl file.
>
> As an example. I modeled the relationship, "AdventititiousRoot isPartOf only
> Root" (isPartOf is a user-defined porperty). I modeled/described this
> relationship under the 'SuperClass' field for the Class 'AdeventitiousRoot'.
> The 'Class Usage' generated was "AdventitiousRoot subClassOf isParOf only
> Root". The associated rdf/xml code is given below.
>
> <!--
> http://www.semanticweb.org/ontologies/2010/1/3/PlantEntities.owl#AdventitousRoot
> -->
>
>    <owl:Class rdf:about="#AdventitousRoot">
>        <rdfs:subClassOf rdf:resource="&owl;Thing"/>
>        <rdfs:subClassOf>
>            <owl:Restriction>
>                <owl:onProperty rdf:resource="#isPartOf"/>
>                <owl:allValuesFrom rdf:resource="#Root"/>
>            </owl:Restriction>
>        </rdfs:subClassOf>
>    </owl:Class>
>
> I parsed this code using JENA's object "statement iterator" and I got
> triples such as "AdventitiiousRoot subClassOf Thing" and "AdventitiousRoot
> subclassOf 6b8720b3:128d06ed301:-7fc6".
>
> I am able to capture the Subject, Predicate and Object in the first
> statement.
>
> My problem is how do I capture the predicate "isPartOf" and the owl
> restriction "only" and avoid generating the hexadecimal reference in the
> second statement?

(I'll follow your lead, and skip the domain prefixes for clarity)

I think you need to understand the RDF structure that you have here.

The RDF/XML above is describing AdventitousRoot as a subClassOf the
resource called Thing, and also as a subClass of another resource that
is a Restriction. This Restriction resource has no name, and hence it
is represented with a blank node. Identifier or not, the system needs
to have some kind of internal representation to uniquely identify this
resource, so it has generated one. This is the reason for the
hexadecimal label that you see.

The unnamed Restriction resource has two further properties which
describe how it does restrictions. It uses the onProperty property to
describe that it restricts the isPartOf predicate, and it uses the
allValuesFrom property is restrict isPartOf to just refer to resources
of type Root.

Everything here is perfectly correct RDF representation of an OWL
class. Apparently, you don't like the fact that your Restriction class
has no identifier. The way around it would be to give it a name.
That's valid RDF, though I can't say if there's a problem in OWL (can
someone enlighten me please? I *think* it's fine, right?). Also,
Protege may not deal with the name correctly (it may ignore it... I
don't know).

Anyway, the provide the Restriction with a name, you only need to add
an rdf:about. The following uses the name AdventitousRestriction in
the same domain as AdventitousRoot:


<owl:Class rdf:about="#AdventitousRoot">
  <rdfs:subClassOf rdf:resource="&owl;Thing"/>
  <rdfs:subClassOf>
    <owl:Restriction rdf:about="#AdventitousRestriction">
      <owl:onProperty rdf:resource="#isPartOf"/>
      <owl:allValuesFrom rdf:resource="#Root"/>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>


Regards,
Paul Gearon

Received on Tuesday, 22 June 2010 14:01:22 UTC