Aziza, the equivalent SPARQL rule would be the following:
CONSTRUCT { ?c a :ContractA }
WHERE
{ ?contract :hasProcess ?p1 .
?p1 hasInitiator ?i1 .
?i1 a :Bank .
?p1 :hasRecipient ?r1 .
?r1 a :Supplier .
?p1 hasInstrument ?fi1 .
?fi1 a :Cash .
?p1 :followedBy ?p2 .
?p2 a :Process .
?contract :hasProcess ?p2 .
?p2 :hasInitiator ?i2 .
?i2 a :Supplier .
?p2 :hasRecipient ?r2 .
?r2 a :Bank .
?p2 :hasInstrument ?fi2 .
?fi2 a :Good .
}
To run this as a rule in SPIN, make sure your model has imported the
SPIN model and inferences are configured to use TopSPIN. Add the
above rule to the class owl:Thing and run inferences.
Note that rules do not need to be globally defined. You can define a
rule on a class and it will be applied to only that class and its
subclasses. For example, if you wanted to run this on instances of
Bank, then remove "?i1 a :Bank" and replace ?i1 with ?this. The rule
will be executed on each entailed member of :Bank, binding ?this to
the member.
If you want to parameterize this with a template, create a subclass of
spin:Templates (subclass of spin:Modules), add the rule to spin:body,
and add arguments and modify the query accordingly. To instantiate
the template as a rule, use "Create from SPIN Template" in the
spin:rule property of the class definition and fill in the arguments.
For more on SPIN, see http://www.topquadrant.com/products/SPIN.html,
including the tutorial in PDF form.
-- Scott
On Mar 2, 1:54 am, aziza <[email protected]> wrote:
> Wanted to ask u why I have a problem with SWRL?
> Here is my example:
> I just wanted to describe the processes between two nodes:Bank and
> BankClient.
> Let's say:
> 1st process: InitialNode - Bank;
> RecipientNode- Supplier;
> Instrument- Cash;
> 2nd process: InitialNode - Supplier;
> RecipientNode- Bank;
> Instrument- Good;
> In other words, Bank buys some good from Supplier- this is what I want
> to model.
> And wanted to make a rule which says if a contract satisfies 1,2
> processes it is of a certain type.
> So, under spin:body ->(?contract hasProcess ?p1) (?p1 hasInitiator ?
> i1) Bank(?i1) (?p1 hasRecipient ?r1) Supplier(?r1) (?p1 hasInstrument ?
> fi1) Cash(?fi1) (?p1 followedBy ?p2) Process(?p2) (?contract
> hasProcess ?p2) (?p2 hasInitiator ?i2) Supplier(?i2) (?p2
> hasRecipient ?r2) Bank(?r2) (?p2 hasInstrument ?fi2) Good(?fi2)
> under swrl:head -> ContractA(?c)
> So, I thought that modelling rule enables to solving a complience
> issue.
> When i run inference one of my contracts had been recognized as a type
> of ContractA.
> But when I wanted to check my rule for correctness and changed a Good
> for Cash(which is wrong) it still was ab;e to recognize a contract and
> referred it to the type of ContractA. Why? Where is my error? Maybe u
> Can suggest me how to write this rule in SPIN? Because I have a number
> of contracts with the same structure with a number of processes.
> Would be very grateful to you , Aziza
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en