RE: Combined Inverse Functional Properties

Hi Rogier,

Here's a set of rules that I believe does what you're suggesting (generates
ordered lists of property values and determines owl:same-ness of those
lists, which in turn implies sameness of subjects based on ifp). Seems to
work fine, though I'm not sure it's better than just treating a cfp as a
primitive notion (since that would avoid littering the triple space with
statements about the identity of lists. Also seems like you could
justifiably say that two lists are identical if neither contains an item
that the other doesn't - e.g. (a,b,b) = (b,a), etc. - but that would lead to
false results for the cfp inference).

Rgds,

Geoff Chappell


==================================================================
import "/std/ns.rql";
import "/std/owl.rql";

session.namespaces["ex"] = "http://www.example.org/sample#";

rulebase cfp
{
	infer {[owl:sameAs] ?l1 ?l2} from sameList(?l1, ?l2);

	infer {?p ?s ?o} from {[ex:productProperty] ?p ?l}
		and getPropList(?s, nil(), ?o, ?l);

	infer sameList(?l1, ?l2) from {[owl:sameAs] head(?l1) head(?l2)}
		and sameList(tail(?l1), tail(?l2));
	infer sameList(?l1, ?l2) from ?l1=nil() and ?l2=nil();

	infer getPropList(?s, ?lin, ?lout, ?l) from ?l=[rdf:nil] and
?lout=?lin;
	infer getPropList(?s, ?lin, ?lout, ?l) from {[rdf:first] ?l ?f} 
		and {?f ?s ?fv}	
		and {[rdf:rest] ?l ?r}
		and getPropList(?s, ?lin, ?lint, ?r)
		and ?lout=list(?fv, ?lint);
}

var ds = new datasource("inet?parsetype=auto&url=c:/temp/testpp.n3");

select ?o using #ds rulebase cfp, owl where  {[owl:sameAs] [ex:x] ?o}


gives:

o                                  
---------------------------------  
[http://www.example.org/sample#y]  
[http://www.example.org/sample#x]  


for data:

@prefix ex: <http://www.example.org/sample#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.

<http://www.example.org/sample#> a owl:Ontology.

ex:p a owl:InverseFunctionalProperty;
	ex:productProperty [ a rdf:List;
		rdf:first ex:r1;
		rdf:rest [ rdf:first ex:r2;
			rdf:rest [ rdf:first ex:r3;
				rdf:rest rdf:nil ] ] ].

ex:r1 a rdf:Property.

ex:r2 a rdf:Property.

ex:r3 a rdf:Property.

ex:x a owl:Thing;
	ex:r1 ex:a;
	ex:r2 ex:b;
	ex:r3 ex:c.

ex:y a owl:Thing;
	ex:r1 ex:a, ex:c;
	ex:r2 ex:b;
	ex:r3 ex:c.




> -----Original Message-----
> From: semantic-web-request@w3.org [mailto:semantic-web-request@w3.org] On
> Behalf Of Rogier Brussee
> Sent: Friday, February 18, 2005 8:42 AM
> To: jos.deroo@agfa.com
> Cc: Dan Brickley; Henry Story; SWIG; semantic-web-request@w3.org; Yuzhong
> Qu
> Subject: Re: Combined Inverse Functional Properties
> 
> 
> Thank you very much for trying this!  Your rules are much cleaner than
> mine. However it seems that I have not been clear in my intentions.
> 
> what I proposed is that if we have rules that given
> 
> :p :productProperty (r1 r2 r3).
> :x :r1 :a;
>     :r2 :b;
>     :r3 :c.
> 
> we infer
> 
>  :x :p (:a :b :c).
> 
> Then if
> 
> :x :p (:a :b :c).
> :y :p (:a :b :c).
> :p a owl:InverseFunctionalProperty.
> 
>  the standard owl axioms (if I understand them correctly)  would imply
> that
> 
> :x owl:sameAs :y.
> 
> Seeing your rules as an example, perhaps the following rules work. At
> least they are much simpler than my original ones (sorry, still no
> rule engine available to test it out myself)
> 
> # the always true predicate
> {} => {?X :true ?Y}.
> 
> :true :productProperty rdf:nil.
> 
> {
> ?P :productProperty ?L.
> ?L rdf:first ?Q.
> ?L rdf:rest ?M.
> ?R :productProperty ?M.
> ?X ?Q ?A.
> ?X ?R ?B
> }
> =>
> {?X ?P (?A ?B)}.
> 
> 
> On Thu, 17 Feb 2005 16:08:34 +0100, jos.deroo@agfa.com
> <jos.deroo@agfa.com> wrote:
> > is indeed better with :productProperty and owl:InverseFunctionalProperty
> > have done test case
> >
> > data   http://eulersharp.sourceforge.net/2004/04test/henry.n3
> > rules  http://eulersharp.sourceforge.net/2004/04test/rogier.n3
> > query  http://eulersharp.sourceforge.net/2004/04test/sameAsQ.n3
> > answer http://eulersharp.sourceforge.net/2004/04test/sameAsE.n3
> >
> > it was tested with command line
> > .euler --nope --think
> > http://eulersharp.sourceforge.net/2004/04test/henry.n3
> > http://eulersharp.sourceforge.net/2004/04test/rogier.n3 --query
> > http://eulersharp.sourceforge.net/2004/04test/sameAsQ.n3
> >
> > and also via getting
> > http://wopeg.he.agfa.be/.euler+--nope+--
> think+http%3A%2F%2Feulersharp.sourceforge.net%2F2004%2F04test%2Fhenry.n3+h
> ttp%3A%2F%2Feulersharp.sourceforge.net%2F2004%2F04test%2Frogier.n3+--
> query+http%3A%2F%2Feulersharp.sourceforge.net%2F2004%2F04test%2FsameAsQ.n3
> >
> > from primitive service
> > java -Xmx800m -Dprocess.cwm="python /cwm-1.0.0/swap/cwm.py"
> > -Dprocess.euler="java -Xmx800m euler.EulerRunner" -Dprocess.ttl=10000 R
> -p
> > 80 -debug
> >
> > (version
> >
> http://sourceforge.net/project/showfiles.php?group_id=77046&package_id=779
> 35&release_id=305730
> > help http://eulersharp.sourceforge.net/2004/01swap/Euler.txt)
> >
> >
> > --
> > Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/
> >
> > Rogier Brussee <rogier.brussee@gmail.com>
> > Sent by: semantic-web-request@w3.org
> > 16/02/2005 16:13
> > Please respond to Rogier Brussee
> >
> >        To:     SWIG <semantic-web@w3.org>
> >        cc:     Henry Story <henry.story@bblfish.net>, Jos
> > De_Roo/AMDUS/MOR/Agfa-NV/BE/BAYER@AGFA, Dan Brickley <danbri@w3.org>,
> > Yuzhong Qu <yzqu@seu.edu.cn>
> >        Subject:        Re: Combined Inverse Functional Properties
> >
> > On Wed, 16 Feb 2005 11:22:57 +0800, Yuzhong Qu <yzqu@seu.edu.cn> wrote:
> > > It seems to me that:
> > >
> > > what CIFP means is very close to that intersectionOf(r1, r2, ..., rn)
> is
> > a reverse functional property.
> > >
> > [snip]
> > Except that it is not so clear what the domain (i.e. "outcome")  of
> :cifp
> > is.
> >
> > > > > I did just a 5 min test with Cwm and Euler :)
> > > > >
> > > > > given data
> > > > >
> > > > > :a :r1 :b.
> > > > > :a :r2 :c.
> > > > > :g :r1 :b.
> > > > > :g :r2 :c.
> > > > > :p :cifp (:r1 :r2).
> > > >
> >
> > It seems to me that the "combined inversefunctional property" is not a
> > primitive notion. It seems more natural and general to have a notion
> > of productProperty (or combined property) which can in particular  be
> > inverse functional. Thus I would replace  the last sentence by :
> >
> > :p :productProperty (:r1:r2).
> > :p a owl:InverseFunctionalProperty.
> >
> > :productProperty should model a list of simulaneous properties, and it
> > seems easiest if it takes values in a list. To be of any use as an
> > inverse functional property we have to assume that two lists are
> > owl:sameAs if their entries are owl:sameAs and have the same order,
> > just as Yuzhong Qu seems to suggest.
> >
> > We can define some rules capturing the notion of :productProperty.
> > I have no rule engine around here but does something like this work ?
> >
> > :productProperty a owl:InverseFunctionalProperty;
> >               rdfs:domain rdf:Property.
> >
> > # bottom of recursion
> > {
> > ?p :productProperty ?L.
> > ?L rdf:first ?q.
> > ?L rdf:rest rdf:nil.
> > }
> > =>
> > {
> >       {?x ?q ?a} <=> {?x ?p ?A. ?A rdf:first ?a. ?A rdf:rest rdf:nil}
> > } .
> >
> > #recursion
> > {
> > ?p :productProperty ?L.
> > ?L rdf:first ?q.
> > ?L rdf:rest ?M.
> > ?r :productProperty ?M}
> > =>
> > {
> >           {?x ?q ?a. ?x ?r ?B} <=> {?x ?p ?A. ?A rdf:first ?a. ?A
> > rdf:rest ?B}
> > }.
> >
> > # ?q :composition (?p rdf:first). ?r :composition (?p rdf:rest). Sigh
> >
> > > > >
> > > > > and some rules capturing only cases for 1, 2 and 3 cifp properties
> > > > >
> > > > > {?C :cifp ?L.
> > > > >  ?L rdf:first ?P;
> > > > >     rdf:rest rdf:nil.
> > > > >  ?A ?P ?X.
> > > > >  ?B ?P ?X}
> > > > >  =>
> > > > > {?A owl:sameAs ?B}.
> > > > >
> > > > > {?C :cifp ?L.
> > > > >  ?L rdf:first ?P;
> > > > >     rdf:rest ?M.
> > > > >  ?M rdf:first ?Q;
> > > > >     rdf:rest rdf:nil.
> > > > >  ?A ?P ?X;
> > > > >     ?Q ?Y.
> > > > >  ?B ?P ?X;
> > > > >     ?Q ?Y}
> > > > >  =>
> > > > > {?A owl:sameAs ?B}.
> > > > >
> > > > > {?C :cifp ?L.
> > > > >  ?L rdf:first ?P;
> > > > >     rdf:rest ?M.
> > > > >  ?M rdf:first ?Q;
> > > > >     rdf:rest ?N.
> > > > >  ?N rdf:first ?R;
> > > > >     rdf:rest rdf:nil.
> > > > >  ?A ?P ?X;
> > > > >     ?Q ?Y;
> > > > >     ?R ?Z.
> > > > >  ?B ?P ?X;
> > > > >     ?Q ?Y;
> > > > >     ?R ?Z}
> > > > >  =>
> > > > > {?A owl:sameAs ?B}.
> > > > >
> > > > >
> > > > > the N3QL query
> > > > >
> > > > > [] q:select {?X owl:sameAs ?Y}; q:where {?X owl:sameAs ?Y}.
> > > > >
> > > > > gave us
> > > > >
> > > > > :a owl:sameAs :a.
> > > > > :a owl:sameAs :g.
> > > > > :g owl:sameAs :a.
> > > > > :g owl:sameAs :g.
> > > > >
> >
> > So nice.
> >
> > > >
> > > >
> > > >
> > > >
> >
> >

Received on Friday, 18 February 2005 15:52:44 UTC