회신: 회신: 회신 : Question about SWRL built-in "hasNumberOfPropertyValues "
"Kang, Sungku" <[email protected]> Thu, 8 Aug 2013 13:52:01 +0000
| Newsgroups | gmane.comp.misc.ontology.protege.general |
|---|---|
| Message-ID | <B88DE67CFCFC1141A0F17C30E592C1DB071F1366@CITESMBX2.ad.uillinois.edu> |
Csongor, Thank you for your help.
I tried more with the polygon example and find out several things. (I attached the modified example)
1. about '˚' operator
When I tested, protege 3.4.8 automatically convert '^' to '˚' but 3.5 does not convert as 3.4.8. However, in both case, query works fine.
(The major difference between two version is, 3.4.8 uses Jess rule engine and 3.5 uses Drools rule engine for default. But I don't think if that's the reason.)
the function of '˚' is just distinguishing three part of the query, "<SWRL Pattern Specification> ° <Set Construction Operators> ° <Set Operations> → <Select Clause>" when set operators are used.
so if the order of the built-in is correct, using '^' or '˚' does not matter.
2. using "sqwrl:groupBy" to separate entire set made by "sqwrl:makeSet"
I modified the rule you use "Polygon(?p) ∧ hasSide(?p, ?v) ^ sqwrl:makeSet(?s, ?v) ^ sqwrl:size(?n, ?s) → sqwrl:select(?p, ?n)"
to "Polygon(?p) ∧ hasSide(?p, ?v) ^ sqwrl:makeSet(?s, ?v) ^ sqwrl:groupBy(?s, ?p) ^ sqwrl:size(?n, ?s) → sqwrl:select(?p, ?n)" ("sqwrl:groupBy" is added)
and the result is like this (the number of element is different from your example since I change several thins.
p1 9
p2 8
p3 6
3. The last thing... the most important thing for me is that even though the query works well, I couldn't classify the instance
by substituting "sqwrl:select(?p, ?n)" to "Triangle(?p)".
I think the reason is query cannot modify the existing ontology to maintain soundness of inference...
If someone know if there are anyway to use the query like rule (classify instance), please let me know.
I think I can classify the instance by using the result of query with API, but I don't think SQWRL is supported by API's other than Protege API...
Regards,
SungKu
________________________________________
보낸 사람: Csongor Nyulas [[email protected]] 대신 [email protected] [[email protected]]
보낸 날짜: 2013년 8월 7일 수요일 오후 2:06
받는 사람: [email protected]
제목: Re: [protege-discussion] 회신: 회신: Question about SWRL built-in "hasNumberOfPropertyValues"
Hi SungKu,
I tried to make an example for you (see attached), but I could not
manage to get it fully to work either. Here are some information,
though, that may be useful for you:
1. The errors that you see (or the ones that I saw, at least), may be
related to the fact that the communication between Protege, SWRLTab and
the Drools engine gets in an inconsistent state. Deactivating and then
reactivating the SQWRLQueryTab (by using the SQ icon in the upper right
corner) may help with this.
2. If you look at the attached example and run the Rule-2 query, which
is simlar to yours:
Polygon(?p) ∧ hasSide(?p, ?v) ^ sqwrl:makeSet(?s, ?v) ^ sqwrl:size(?n,
?s) →
sqwrl:select(?p, ?n)
you'll get:
p1 6
p2 6
p3 6
so the sqwrl:makeSet() works on the entire set of vertices, which are a
side of any polygon. This is not what we want. As it is described in
[1], you should separate the set construction and manipulation
operators from the standard SWRL pattern specification using the °
character. When editing a SWRL rule you can insert the '°' character
simply by typing '.' . So, I think the correct rule should look
something like this:
Polygon(?p) ∧ hasSide(?p, ?v) ˚ sqwrl:makeSet(?s, ?v) ˚ sqwrl:size(?n,
?s) →
sqwrl:select(?p, ?n)
If this is successful, you can replace the right hand side with
Triangle(?p). However, I did not manage to make Protege store the rule
with the ° character :( therefore, I can't say for sure how it will
work. Maybe somebody with more expertise would know.
Regards,
Csongor
[1]
http://protege.cim3.net/cgi-bin/wiki.pl?action=browse&id=SetsSQWRL&revision=7
On 08/06/2013 02:06 PM, Kang, Sungku wrote:
> So I'm struggling with SQWRL several days and couldn't implement what I want to.
>
> The thing I want to implement is like this.
>
> "Polygon(?p) ∧ hasSide(?p, ?v) ∧ sqwrl:makeSet(?s, ?v) ∧ sqwrl:size(3, ?s) → Triangle(?p)"
>
> That way, I will be able to classify instances according to the number of relation with other type of instances.
>
> However, when I tested the above statement with a small owl files, it gives error as below.
> (I tried several versions of protege including 3.4.6, 3.4.8, 3.5)
>
> 1. when I added the rule describing the above statement and run reasoner,
> it gives an error saying "Cannot convert rule DefaultSWRLImp("name of rule" of [DefaultOWLNamedClass(http://www.w3.org/2003/11/swrl#Imp)])
> (same error with the SQWRL example provided)
>
> 2. when I use SQWRLQueryTab and run the above statement,
> it gives an error saying that "Exception when running SQWRL query "name of rule": error running SQWRL queries: error running rule engine: error inserting OWL axioms into Drools(or Jess) rule engine: null
>
> Are there anything wrong in my implementation? or SQWRL is not capable of realizing the concept I want to realize?
>
> Regards,
>
> SungKu Kang
>
> ________________________________________
> 보낸 사람: Samson Tu [[email protected]] 대신 [email protected] [[email protected]]
> 보낸 날짜: 2013년 8월 1일 목요일 오전 11:54
> 받는 사람: [email protected]
> 제목: Re: [protege-discussion] 회신: Question about SWRL built-in "hasNumberOfPropertyValues"
>
> No, SQWRL built-ins can be used on the LHS of a rule too.
>
> The sqwrl construct I gave in the last message was wrong. A correct
> example is
>
> a(B_8, ?value) ∧ sqwrl:makeSet(?s, ?value) ∧ sqwrl:size(2, ?s)
> → b(?value, B_9)
>
> Samson
>
> On 7/31/2013 10:43 PM, Kang, Sungku wrote:
>> As far as I know, SQWRL built-in primitives can only be used for the result (after ->) so it would not help reasoning based on the cardinality but just help querying existing information.
>>
>> Therefore, since hasNumberOfPropertyValues is no longer supported, there is no primitive supporting reasoning based on the cardinality (which is only available on closed world assumption) with SWRL.
>>
>> Am I right?
>>
>> If there's another way to implement the reasoning based on the cardinality or use previous version of SWRL (which has hasNumberOfPropertyValues), please let me know.
>>
>> Regards,
>>
>> SungKu
>> ________________________________________
>> 보낸 사람: Samson Tu [[email protected]] 대신 [email protected] [[email protected]]
>> 보낸 날짜: 2013년 7월 31일 수요일 오후 6:23
>> 받는 사람: [email protected]
>> 제목: Re: [protege-discussion] Question about SWRL built-in "hasNumberOfPropertyValues"
>>
>> I don't find hasNumberOfPropertyValues documented in the
>> SWRLAboxBuiltIns wiki page. I assume the built-in is no longer supported.
>>
>> You can duplicate the functionality of hasNumberOfPropertyValues using
>> the sqwrl:count(..) built-in.
>>
>> hasNumberOfPropertyValues(3, AnInstance, aProperty) is exactly the same as
>>
>> aProperty(AnInstance, ?value) and sqwrl:count(3, ?value)
>>
>>
>> Samson
>>
>>
>> On 7/31/2013 1:39 PM, Kang, Sungku wrote:
>>> To whom it may concern,
>>>
>>> My name is SungKu, who's working as a graduate research assistant in UIUC.
>>>
>>> I'd like to perform reasoning based on the number of object related
>>> through a certain property,
>>>
>>> so I need to use SWRL built-in "hasNumberOfPropertyValues" in abox of
>>> SWRL built-in.
>>>
>>> However, I couldn't write a rule using "hasNumberOfPropertyValues" even
>>> though abox is imported properly.
>>> (I tried this with both latest version of protege, 4.3 and the old
>>> version of protege, 3.4)
>>>
>>> Here's my question for the issue.
>>>
>>> 1. I know that "hasNumberOfPropertyValues" has risk to modify existing
>>> information of ontology.
>>> So, "hasNumberOfPropertyValues" has been deprecated because of the
>>> issue?
>>> If so, are there any way to use old version of built-in, which has
>>> "hasNumberOfPropertyValues"?
>>>
>>> 2. If it is not deprecated, is there any way to use it?
>>>
>>> 3. If it is deprecated and old version is not accessible, is there any
>>> alternative for "hasNumberOfPropertyValues"
>>> in the current built-in?
>>>
>>> If you are not able to help me, please let me know the person I can
>>> contact for the issue.
>>>
>>> Thank you for your help and I hope you have a nice day!
>>>
>>> Regards,
>>>
>>> Kang, SungKu
>>>
>>>
>>> _______________________________________________
>>> protege-discussion mailing list
>>> [email protected]
>>> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>>
>>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>>
>>
>> _______________________________________________
>> protege-discussion mailing list
>> [email protected]
>> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>
>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>> _______________________________________________
>> protege-discussion mailing list
>> [email protected]
>> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>
>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>
>
> _______________________________________________
> protege-discussion mailing list
> [email protected]
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
> _______________________________________________
> protege-discussion mailing list
> [email protected]
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
_______________________________________________
protege-discussion mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/protege-discussion
Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Polygon.owl
(application/octet-stream, 32.5 KB) - not displayed