Thank you Lorenz Bühmann for answering my email.
But what do you mean by using the URI I have in mind?
I want to create an instance to a class already in the ontology. For example,
If I have these triples in my data:
inst1 type class1
inst1 hasPrice price
inst1 hasValue value
class2 type Class
I would like the rule to be something like:
if (price>value) then create inst2 of type class2 and add text value to inst2
Thanks
Abdul
From: Lorenz B. <[email protected]>
To: [email protected]
Sent: Thursday, March 30, 2017 7:43 AM
Subject: Re: Jena Rules
> Hello,I am trying to excute this rule in Jena:
>
> [r1: (?c http://somewhere#rel1 ?price)
> (?c http://somewhere#rel2 ?value) lessThan(?price, ?value) ->
> (?y http://somewhere#AnyRelation 'Some Text')]
> I have two questions:1- I would like ?y to be a specific instance of a
> specific class and created during the excution of the rule. How to create
> that instance in the rule? if it can be, is there a way that instance to be
> not blank node?
> I found this in the Jena documentations:
>
> makeInstance(?x, ?p, ?v)makeInstance(?x, ?p, ?t, ?v)
> but I do not know how to use it because ?v is the blank node so what is ?x?
That built-in only creates blank nodes used as a value for a known
resource ?x and property ?p. If you want to create an instance, why
don't you use the URI you have in mind?
>
> 2- How to add prefixes in rules?
You can add this to the file containing the rules:
@prefix pre: <http://domain/url#>.
>From the Jena documentation [1]: "Defines a prefix pre which can be used
in the rules. The prefix is local to the rule file."
[1] https://jena.apache.org/documentation/inference/#rules
> ThanksAbdul
>
>
>
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center