> Is it possible to write swrl rules like Person(?p), Topic(?t) ->
> (researchTopics value ?t)(?p) ?
> I know that I don't need to use a swrl rule to do this, but this is
> just an
> example. I will need to do something more complex, but based in this
I don't know if you can use variables in the class expression. I
would guess probably not, but I'm sure Martin O'Connor will give a
For your particular case, you can in effect make the inference work
the other way.
As it is set up in your rule, you are asserting membership in a class
which then forces a particular value for a property filler. Instead,
it would be possible and to my mind simpler to just make the base
assertions that you need. If you find that having a class defined
based on that particular assertion, you can always define it and then
have inference identify the individuals that satisfy the description.
So your example rule would become:
Person(?p), Topic(?t) -> researchTopics(?p,?t)
which should accomplish the same net effect. Certainly using a value
restriction from an anonymous class description doesn't make much
sense, since there are easier ways to do that. Some of the other
restrictions such as cardinality restrictions would be more
interesting, because you must use class descriptions to assert them.
So, I don't think that you can build anything like
pCount(?p, ?n) -> (p => ?n)(?p)
to turn the value of a property into a cardinality restriction.
You're right Thomas, I don't need to use a restriction to do that. This was just a simple example. If I could use variables in class expressions it would solve my problem. In fact, what I need is a bit more complex.
Suppose that we have a domain ontology (let's say, ISWC.owl ), that is not temporally characterized. We want to add a temporal dimension, so we can say that, for instance, the concept of Project is something that occurs in some period of the universal timeline. Besides that, we must also be able to say that some relation holds during some period of time. For instance, let’s say that the relation "involvedInProject" between some Person and some Project is true during some period of time.
The next figure represents a very small excerpt of ISWC ontology, used as use case for this example.
Saying that an relation holds during some period could be achieved by adding one parameter to the relation: involvedInProject(Person,Project,TimeInterval).
But because OWL is about triples, only we have is binary predicates. To overcome this problem Noy and Rector developed an ontology pattern . This is the pattern that we are currently considering to model n-ary relations in OWL.
So, according to this pattern, if we want to say that some Person is involded in some project during some period of time we should create a new class to represent the n-ary relation:
Proceeding similarly for the relation researchTopics(Person,Topic), we get the ontology presented in the next figure:
Now, suppose that we had previously defined that if some Person is involved in some Project, then that Person does research about the Topics that this Project is about.
This could be achieved through the following swrl rule:
However, we changed the original ontology, adding the temporal dimension. In this particular case we probably want to change the swrl rule so it can infer the research topics of some Person during some TimeInterval based on his Project participation at some TimeInterval.
This could be achieved by making some changes to the original swrl rule, namely:
- get the time interval of the Person participation over project, searching through the new relation created to reflect n-ary predicates;
- create a new instance to play the role of reification;
- infer relations of the new instance.
The problem is that reasoners such Pellet, Hermit or Fact++ doesn't allow the creation of new entities at reasoning time (because saffety reasons), so it's not possible to create the necessary structure for representing infered n-ary relations. We know that Jess reasoner use the built-in swrlx:makeOWLThing to create new anonymous instances at reasoning time, but unfortunatly it is a commercial reasoner.
Other way to achieve that could be using a class expression:
-> iswc:researchTopics some
(TemporalRelation and ((during value ?time) and (hasValue value ?topic)))(?p)
But as you and Martin said, this is not an option, because we can not use variables in class expressions.
I hope the explanation was not too confusing. I'm out of ideas right now.
On 6/1/2011 3:19 AM, Lukapt wrote
> The problem is that reasoners such Pellet, Hermit or Fact++ doesn't allow
> the creation of new entities at reasoning time (because saffety reasons), so
> it's not possible to create the necessary structure for representing infered
> n-ary relations. We know that Jess reasoner use the built-in
> swrlx:makeOWLThing to create new anonymous instances at reasoning time, but
> unfortunatly it is a commercial reasoner.
The ability to 'create' individuals on the fly in SWRL is essential for many tasks (as you have discovered). However,
SWRL does not really support this creation in a convenient way. The use of the owl:someValuesFrom property restriction
provides a possible mechanism for doing this (as you are attempting) but it is very limited. (And for reasons of
DL-safety  current reasoners will not even do this much.)
So you are stuck with using the swrlx:makeOWLThing built-in , which is non standard. As you noted, this built-in is
currently only supported by the SWRLTab, which requires the commercial Jess back end for inference (though it is free
for academic and US government users). However, I hope to have an open source Drools back end available later this year.
BTW, there is also a temporal built-in library available in the SWRLTab, which may help you with temporal operations. In
addition to built-ins, it also provides a valid-time temporal model. Again, however, it is only supported in the SWRLTab
using the Jess back end.