Search Mailing List Archives
[protege-owl] How to count the Instances of Concept
Najeeb Elahi
najeeb at kth.se
Tue Apr 20 05:55:35 PDT 2010
Hi everyone,
I want to count the number of instance one concept contains. Let say I have two concepts <foaf:person> and <foaf:Image>, bound with relationship foaf:image
Is there any way that I can infer which person has more Image’s instances than other? If this cannot be resolved in ontology design, I’m wondering, SWRL rule might help.
Thanks in advance
Best Regards
Najeeb Elahi
________________________________________
From: protege-owl-bounces at lists.stanford.edu [protege-owl-bounces at lists.stanford.edu] On Behalf Of Martin O'Connor [martin.oconnor at stanford.edu]
Sent: Saturday, March 13, 2010 10:42 PM
To: User support for the Protege-OWL editor
Subject: Re: [protege-owl] Question: SWRL and Qualifiers
I really would not go down this path.You may be better off implementing
a solution outside of OWL or SWRL.
Martin
paddy joesoap wrote:
> Thanks Martin.
>
> This is interesting, as it appears I will have to write multiple SWRL
> rules to capture this scenario across each condition field.
>
> By my calculations that is 2^{n-1}-1 SWRL rules.
>
> For example,
>
> If n =3 there are 3 SWRL rules to capture the possibility that there
> exists at least one possibility where a.Condition is a superset of
> b.Condition and for all other possibilities a.condition is a subset of
> b.Condition.
>
> For example if
> a.ci={10, ..., 20}, a.cj ={2, ...,4}, a.ck ={150,...,160} and
> b.ci={15, ..., 18}, b.cj={1,...,9}, b.ck ={150, 200} then
>
> "a" is correlated to "b" because there exists a situation where a.ci
> is a superset of b.ci and for all other corresponding conditions is
> has a subset relation to those of "b".
>
> SWRL rules will have to be written to test each possible value of each
> condition field in order to find the above situation.
>
> Column A, Column B, ColumnC, ColumnD
> a.ci superset b.ci AND a.cj superset b.cj AND a.ck superset b.ck , INVALID
> a.ci superset b.ci AND a.cj superset b.cj AND a.ck subset b.ck, VALID
> a.ci superset b.ci AND a.cj subset b.cj AND a.ck superset b.ck, VALID
> a.ci superset b.ci AND a.cj subset b.cj AND a.ck subset b.ck, VALID
>
>
> Note columnA has the same superset relation check and this is the
> reason for the n-1 since this correlation relation is symmetrical.
> Note while there are 4 combinations (same as a 2-input truth table),
> only 3 are valid. This is because the first row does not uphold the
> following:
> "a" is correlated to "b" , if there exists at least one condition of
> "a" that is superset of the corresponding condition of "b" and the
> remaining conditions of "a" are subsets of "b".
> Hence the minus 1 in the formula, to remove this check.
>
> Of course if I have even a slightly moderate Condition tuple set, then
> the number of SWRL rules explodes, for example if n=8 there are 127
> swrl rules to be written to capture all possible valid combinations.
>
> Anyhow thanks for letting me know that existential is not used in SWRL.
>
> regards,
> Paddy.
>
>
>
>
> On Sat, Mar 13, 2010 at 6:57 PM, Martin O'Connor
> <martin.oconnor at stanford.edu> wrote:
>
>> SWRL's semantics can be found in the SWRL Submission [1]. Basically, SWRL
>> variables are universally quantified and local in scope to a rule.
>> Existentials are not allowed directly but can be supported indirectly using
>> the owl:SomeValuesFrom axiom.
>>
>> However, all SWRL implementations that I am aware of will not support
>> existentials because they adopt a DL-safe interpretation when executing SWRL
>> rules. See [2] for a discussion.
>>
>> The SWRLTab has a built-in library that effectively supports existentials
>> [3], though this solution is very much non standard.
>>
>> Martin
>>
>> [1] http://www.w3.org/Submission/SWRL/
>> [2] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ#nid9VC
>> [3] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLExtensionsBuiltIns
>>
>> paddy joesoap wrote:
>>
>>> Hi,
>>>
>>>
>>> The following includes a more in depth description of what I'd like to
>>> achieve. I wrote it in Latex to make express the the discrete math
>>> notation formally that I want to model in SWRL.
>>>
>>> I want to express the following in SWRL.
>>>
>>> \begin{eqnarray*}
>>> a.Condition \leftrightarrow b.Condition &\equiv &
>>> c_{i},c_{j}:Condition \wedge c_{i} \neq c_{j} \wedge \\
>>> && \exists c_{i} ~|~ a.c_{i} \supseteq b.c_{i} \wedge \\
>>> && \forall c_{j} ~|~ a.c_{j} \subseteq b.c_{j}
>>> \end{eqnarray*}
>>>
>>> BACKGROUND BELOW:
>>>
>>> An individual can be defined in terms of an ordered 2-tuple in the
>>> following way:
>>> \begin{eqnarray*}
>>> Individual \equiv Index \times Condition
>>> \end{eqnarray*}
>>>
>>> Ignore the $Index$ and focus on $Condition$ to get to what I want to
>>> represent in SWRL.
>>>
>>> The set of conditions (Condition) is defined as an 3-tuple
>>> \begin{eqnarray*}
>>> Condition \equiv NumberSetA \times NumberSetB \times NumberSetC
>>> \end{eqnarray*}
>>>
>>> where the following holds:
>>>
>>> \begin{eqnarray*}
>>> NumberSetA &\equiv& \{0, \ldots, 200 \} \\
>>> NumberSetB &\equiv& \{0, \ldots, 10 \} \\
>>> NumberSetC &\equiv& \{150, \ldots, 300 \} \\
>>> \end{eqnarray*}
>>>
>>> Subsumption Condition:
>>> The conditions of $a$ subsumes those of $b$, if every condition field
>>> of $a$ is equal to or is a subset of the corresponding condition
>>> fields of $b$
>>>
>>> \begin{eqnarray*}
>>> a.Condition \subseteq b.Condition & \equiv & a.NumberSetA \subseteq
>>> b.NumberSetA \wedge \\
>>> && a.NumberSetB \subseteq b.NumberSetB \wedge \\
>>> && a.NumberSetC \subseteq b.NumberSetC \wedge \\
>>> \end{eqnarray*}
>>>
>>>
>>> $a$, $b$ have a correlated subsumption relationship ($\leftrightarrow$
>>> relation), if there exists at least one condition of $a$ that is
>>> subsumed by the corresponding condition of $b$ and the remaining
>>> conditions of $a$ are subsumed by $b$.
>>> \begin{eqnarray*}
>>> a.Condition \leftrightarrow b.Condition &\equiv &
>>> c_{i},c_{j}:Condition \wedge c_{i} \neq c_{j} \wedge \\
>>> && \exists c_{i} ~|~ a.c_{i} \supseteq b.c_{i} \wedge \\
>>> && \forall c_{j} ~|~ a.c_{j} \subseteq b.c_{j}
>>> \end{eqnarray*}
>>>
>>>
>>> In OWL-DL, I can model $Individual$ as class $IndividualClass$, $a$
>>> and $b$ can be modelled as instances of this class. Similarly classes
>>> for the 3 number sets and property relationships can be modelled.
>>>
>>> In SWRL, I can work with subsumption by defining ranges over the
>>> NumberSetA, NumberSetB and NumberSetC sets.
>>>
>>> A NumberSetA range is an inclusive interval $RangeA$, such that
>>> $Range=[startA,endA]$, where $startA,endA \in NumberSetA$ and $startA
>>> \leq endA$. For example, the interval $RangeA=[10, 20]$ represents an
>>> ordered set of numbers where $RangeA=\{10, \ldots, 20 \}$. A similar
>>> approach is taken for NumnberSetB and NumberSetC.
>>> $Range=[startA,endA]$ can be modelled in OWL-DL as $hasStartRangeA$
>>> and $hasEndRangeA$.
>>>
>>> For example to check if $a$ has a set of values in NumberSetA that are
>>> a subset of a range of values in $b$'s corresponding NumberSetA
>>> values, the following SWRL fragment can capture this knowledge.
>>> IndividualClass(?a) AND
>>> IndividualClass(?b) AND
>>> hasStartRangeA(?a,?x) AND
>>> hasEndRangeA(?a,?y) AND
>>> hasStartRangeA(?b,?w) AND
>>> hasEndRangeA(?b,?z) AND
>>> hasIntegerValue(?x,?i) AND
>>> hasIntegerValue(?y,?j) AND
>>> hasIntegerValue(?w,?k) AND
>>> hasIntegerValue(?z,?l) AND
>>> greaterThanOrEqual(?i,?k) AND
>>> lessThanOrEqual(?j,?l) IMPLIES
>>> isCorrelatedTo(?a,?b)
>>>
>>>
>>> However, I would like know if the use of Existentials in the SWRL
>>> rules are allowed so that I can fully model the following:
>>>
>>> \begin{eqnarray*}
>>> a.Condition \leftrightarrow b.Condition &\equiv &
>>> c_{i},c_{j}:Condition \wedge c_{i} \neq c_{j} \wedge \\
>>> && \exists c_{i} ~|~ a.c_{i} \supseteq b.c_{i} \wedge \\
>>> && \forall c_{j} ~|~ a.c_{j} \subseteq b.c_{j}
>>> \end{eqnarray*}
>>>
>>>
>>>
>>> On Sat, Mar 13, 2010 at 5:09 PM, Jean-Marc Vanel
>>> <jeanmarc.vanel at gmail.com> wrote:
>>>
>>>
>>>> Sorry Paddy , too crude !
>>>> Can you please write that in plain english ?
>>>> 2010/3/13 paddy joesoap <paddyjoesoap at gmail.com>
>>>>
>>>>
>>>>> Hi there,
>>>>>
>>>>> Can the SWRLTab for Protege-3.4 handle existential qualifiers?
>>>>>
>>>>> For example (very crude!):
>>>>>
>>>>> \exists x : a.x somePropertyHolds b.x AND
>>>>> \forall y : a.y someOppositeorDifferentPro b.y AND
>>>>> x not equal to y.
>>>>>
>>>>> thanks,
>>>>> Paddy.
>>>>> _______________________________________________
>>>>> 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
>>>>>
>>>>>
>>>> --
>>>> Jean-Marc Vanel
>>>> Consulting, services, training,
>>>> Rule-based programming, Semantic Web
>>>> http://jmvanel.free.fr/
>>>> +33 (0)6 89 16 29 52 -- +33 (0)1 39 55 58 16
>>>> ( we rarely listen to voice messages, please send a mail instead )
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>>
>> _______________________________________________
>> 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
>>
>>
> _______________________________________________
> 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
>
>
_______________________________________________
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