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] Finding Maximum of Sum

Martin O'Connor martin.oconnor at stanford.edu
Mon Jul 26 09:06:40 PDT 2010


There is only one collection construction clause so you cannot do 
multi-level aggregations in the current language.

Martin

Hakan BULU wrote:
>
> Hi Martin,
>
> actually my rule is more complicated, so i need to use maxValue in 
> rule again, not a result of rule.
>
> Simply;
> *Step1 :* Put in some float values in a ?Bag1. Groupby ?Bag1 and get 
> sum into ?Sum1.
> *Step2 (Finding Max value of ?Sum1) :* Put in all ?Sum1 into ?Bag2 , 
> Groupby ?Bag2 and get Max value into ?Max1.
> *Step3 :* Put in all ?Max1 into ?Bag3 and Groupby ?Bag3. Than get sum 
> of ?Bag3 into ?Sum2.
>  
> but in step2, when i try to create Bag2, getting exception of "makeBag 
> in rule Rule-3 returned with unbound arguments" because type of 
> variable ?Sum1 is not a float. Type of #nil.
> In SWRL i can't use xsd:double type.
>  
> So i can't find the solution of my problem.
> regards.
>  
> Hakan BULU
> On Fri, Jul 23, 2010 at 9:38 PM, Martin O'Connor 
> <martin.oconnor at stanford.edu <mailto:martin.oconnor at stanford.edu>> wrote:
>
>
>     Firstly, you should be using a bag here [1], not a set. Sets do
>     not allow duplicate elements so the sum operator will not work as
>     expected.
>
>
>     Person(?p) ^ unterrichtet_Vorlesung(?p, ?m) ^ AnzahlSWS(?m, ?a)  ˚
>     sqwrl:makeBag(?b, ?a) ^ sqwrl:groupBy(?b, ?p) ˚
>     sqwrl:sum(?sum, ?b) ^ swrlb:lessThan(?sum, 16) →
>     sqwrl:select(?sum, ?p)
>
>     You can use the core aggregate operators in the consequent to get
>     the maximum sum:
>
>
>     Person(?p) ^ unterrichtet_Vorlesung(?p, ?m) ^ AnzahlSWS(?m, ?a)  ˚
>     sqwrl:makeBag(?b, ?a) ^ sqwrl:groupBy(?b, ?p) ˚
>     sqwrl:sum(?sum, ?b) → sqwrl:max(?sum)
>
>     You can not cascade collections in the way that you are
>     attempting. All collection construction operators must be in the
>     connection construction clause [2] (between the two ˚s).
>
>     If you want the maximum sum and the person you will need to get a
>     little creative:
>
>
>     Person(?p) ^ unterrichtet_Vorlesung(?p, ?m) ^ AnzahlSWS(?m, ?a)  ˚
>     sqwrl:makeBag(?b, ?a) ^ sqwrl:groupBy(?b, ?p) ˚
>     sqwrl:sum(?sum, ?b) →
>     sqwrl:select(?sum, ?p) ^ sqwrl:orderByDescending(?sum) ^
>     sqwrl:firstN(1)
>
>     Martin
>
>     [1] http://protege.cim3.net/cgi-bin/wiki.pl?CollectionsSQWRL#nidB8S
>     [2] http://protege.cim3.net/cgi-bin/wiki.pl?CollectionsSQWRL#nidB91
>
>     Hakan BULU wrote:
>
>         Hi all,
>          from Thomas's mail we have a SWRL rule;
>          Person(?p) ^ unterrichtet_Vorlesung(?p, ?m) ^ AnzahlSWS(?m,
>         ?a)  ˚
>         sqwrl:makeSet(?s, ?a) ^ sqwrl:groupBy(?s, ?p) ˚
>         sqwrl:sum(?sum, ?s)  ^ swrlb:lessThan(?sum, 16)   →
>         sqwrl:select(?sum, ?p)
>          i have a rule similar this one. and i'm trying to find
>         maximum ?sum value.
>          while trying to sqwrl:makeSet(?set,?sum) ,  i get following
>         exeption: makeSet in rule Rule-3 returned with unbound arguments.
>          also sqwrl:max(?max,?sum) is not working, because atom needs
>         a collection.
>          best regards...
>
>
>         -- 
>         Hakan BULU
>         Ph.D. student in Dokuz Eylul University
>         Department of Computer Engineering
>         TURKEY
>         +90 232 412 79 73
>         +90 536 248 49 10
>         ------------------------------------------------------------------------
>
>
>
>         _______________________________________________
>         protege-owl mailing list
>         protege-owl at lists.stanford.edu
>         <mailto:protege-owl at lists.stanford.edu>
>         https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
>         Instructions for unsubscribing:
>         http://protege.stanford.edu/doc/faq.html#01a.03
>          
>
>
>     _______________________________________________
>     protege-owl mailing list
>     protege-owl at lists.stanford.edu <mailto:protege-owl at lists.stanford.edu>
>     https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
>     Instructions for unsubscribing:
>     http://protege.stanford.edu/doc/faq.html#01a.03
>
>
>
>
> -- 
> Hakan BULU
> Ph.D. student in Dokuz Eylul University
> Department of Computer Engineering
> TURKEY
> +90 232 412 79 73
> +90 536 248 49 10
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>   




More information about the protege-owl mailing list