How to use SQWRL to query a class that is related to an individual of another class?

287 Views Asked by At

I'm new to SQWRL, so I'm doing some tests in a ontology I created in a course.

In that ontology, there's a class named BallpointPen, that has some kinds of ballpoint pens as subclasses; also, there's a class named PenCharacteristic, which has the possible characteristics for pens as individuals.

I want to verify which ballpoint pens (that are subclasses of the class BallpointPen) have the characteristic Refillable (which is an individual of the class PenCharacteristic). For that, I declared the following SQWRL query:

tbox:sca(?x, BallpointPen) ^ hasCharacteristic(?x, Refillable) -> sqwrl:select(?x)

It should point two answers: the classes MyInnovativeBallpointPen and RefillableBallpointPen, but it shows no results. Could someone please help me with this?

1

There are 1 best solutions below

0
Daniel On BEST ANSWER

After some research, I found out that the query cannot be done, at least not with SQWRL, because it cannot work with classes and instances at the same time. One way to do it would be to turn BallpointPen subclasses (which include the answers to the query I was trying to do) into instances.

The only way to make the query in the way that ontology currently is, is by using DL Query. In the DL Query tab (on Protégé), just type and execute:

BallpointPen and hasCharacteristic value Refillable

This will show the proper results.