Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Ask about Calculating Sum Using swrl Rules

Martin O'Connor martin.oconnor at
Wed Feb 17 11:42:41 PST 2010

These types of calculations generally involve closed world reasoning so 
are not possible in SWRL.

You can use SQWRL's new collection operators [1] to make queries of this 

For example, you can calculate the total number of doses in an ontology 
for the drug DDI as follows:

 Patient(?p) ^ hasTreatment(?p,?t) ^ hasDrug(?t, DDI) ^ hasDose(?t,?dose) .
 sqwrl:makeBag(?b, ?dose) .
 sqwrl:size(?n, ?b)
 -> sqwrl:select(?n)

As always, the results of SQWRL queries can not be used in rules.



Zhaoyuan Zhang wrote:
> Hi,
> I have some problems with calculating the sum in using swrl math build-ins. Acually, I want to calculate something like this:
>  ∑P. P is a set of objects within the ontology that shares some common properties. I want to calcualte the sum of that property of all the individuals in that set. Is there any way to accomplish this? Please give me some hints.
> Regards,
> Zhaoyuan Zhang
> _______________________________________________
> protege-owl mailing list
> protege-owl at
> Instructions for unsubscribing:

More information about the protege-owl mailing list