Thanks Niels for the reply.

[AgeRule: (?person1 ex:person_Age ?age) (?person2 ex:person_Age ?age) ->
(?person1 ex:sameAge ?person2)] works fine for the purpose.

Now let's assume that person1 has two properties: sonAge and daughterAge
and I would like to infer a rule like person1 hasTwins. How would I write
it ?

Thanks, Lookman
Le 4 août 2016 06:42, "Niels Andersen" <[email protected]> a écrit :

> A general recommendation, please make sure that the properties that you
> choose clearly describes the direction of the relationship. It is not clear
> if ?f or ?a is the father.
>
> There are probably a million opinions about how to do this, my general
> recommendation is to create properties that show the class to the left and
> the relationship to the right, so ?a ex:person_Father ?b would mean that
> ?a's father is ?b. It also makes it clear that the domain of
> ex:person_Father is ex:Person and the range of ex:person_Father is
> ex:Father.
>
> Not sure if I understand your question, but you could do the following to
> compare ages
> [AgeRule: (?person1 ex:person_Age ?age) (?person2 ex:person_Age ?age) ->
> (?person1 ex:sameAge ?person2)]
>
> This rule would only trigger if both ?person1 and ?person2 are the same
> age.
>
> More specifically you could say:
>
> [UncleRule: (?person experson_Father ?father) (?father ex:person_Brother
> ?uncle) -> (?person ex:person_Uncle ?uncle)]
> [UncleAgeRule: (?person1 ex:person_Uncle ?person2) (?person1 ex:person_Age
> ?age) (?person2 ex:person_Age ?age) -> (?person1 ex:hasUncleWithSameAge
> ?person2)]
>
> Not sure why you would do that, but it is just an example.
>
> Niels
>
>
> -----Original Message-----
> From: lookman sanni [mailto:[email protected]]
> Sent: Wednesday, August 3, 2016 20:37
> To: [email protected]
> Subject: Notation 3 Rule specification
>
> Hi all,
>
> I am beginning with Jena and I struggle with the specification of a rule
> that would help infer new statements.
>
> More concretely, I would like to know how to compare values of different
> properties of a same resource in a rule file, following the n3 syntax.
>
> E.g. [rule1: (?f pre:father ?a) (?u pre:brother ?f) -> (?u pre:uncle ?a)]
>
> If we assume f and u have a property age and I would like to test whether
> that property has the same value or not for both, how would I do it ?
>
> Thanks, Lookman
>

Reply via email to