简体   繁体   中英

Make SWRL request using OWL API

I'm working with an OWL file generated using Protégé. I'm using the OWL API in my Java code. I have a set of defined classes, eg:

SpeciesA ⊑ Species ⊓ ∃hasPart.Fruit ⊓ =hasShape.round
SpeciesA is of subClass Species, hasPart some Fruit and hasShape value Round.

That is all defined in Protégé, then exported to OWL, then loaded in my ontology in Java. If I create an Individual x of Species and I had the properties

  • hasPart(x,FruitA)
  • hasShape(x,Round)

I retrieve every class to which my individual belongs (in this case, this should include SpeciesA).

I'm not sure at all what I should use : Can I use SWRL Species(?x)^hasPart(?x,Fruit)^hasShape(?x,"$Round$") or should I use a Reasoner ?

I'm really confused with Protégé "equivalent to" and individuals property..

In general, if you don't have an assertion that some individual x belongs to a certain class, then you'll need a reasoner to infer that for you (provided that it follows from some other data that you do have). This applies whether the inference is based on OWL axioms or SWRL rules. (Of course, in the case of SWRL rules, you'll need a reasoner, such as Pellet or HermiT, that supports SWRL rules.) In the case that you're describing, you've said that

SpeciesA ⊑ Species ⊓ ∃hasPart.Fruit ⊓ =hasShape.round

This means that each thing that is a SpeciesA is a species, has some fruit as a part, and has the shape round. It does not say, however, that everything that's a Species, has some fruit as a part, and has the shape round is a SpeciesA. It may help to look at what this would be in a first-order-logic:

∀x[ SpeciesA(x) → ( Species(x) ∧ ∃y[ hasPart(x,y) ] ∧ hasShape(x,round) ) ]

Note that the conditional only goes from left to right. If you additionally want to say that everything that satisfies the conditions on the right is an instance of the concept on the left, then you probably want an equivalence:

∀x[ SpeciesA(x) ↔ ( Species(x) ∧ ∃y[ hasPart(x,y) ] ∧ hasShape(x,round) ) ]

In OWL, that would be

SpeciesA ≡ Species ⊓ ∃hasPart.Fruit ⊓ =hasShape.round

That is, SpeciesA is an equivalent class to the other class. You'll still need a reasoner, though, to infer that something that has these conditions is a SpeciesA.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM