W3C home > Mailing lists > Public > www-rdf-interest@w3.org > November 2001

Re: property inference rule

From: Wolfram Conen <conen@gmx.de>
Date: Mon, 05 Nov 2001 19:49:50 +0100
Message-ID: <3BE6DF4E.7250F34@gmx.de>
To: Nikita Ogievetsky <nogievet@cogx.com>
CC: www-rdf-interest@w3.org
See below (attached as a txt-File) one possible solution in
syntactically "pure" (but semantically extensible and embedded) RDF that
you can feed into the RDF Schema Explorer
(http://wonkituck.wi-inf.uni-essen.de/rdfs). Simply copy the file to the
multiline entry (there is one long line in, make sure that the line is
not broken from copy and paste or the output has one unneccessary
newline), then hit the "Parse"-Button and enter hasNiece(X,Y) into the
query field.

Enjoy,
	Wolfram (with some XML/RDF help from Reinhold, as usual ;)


> Nikita Ogievetsky wrote:
> 
> Does anybody know a way to express
> an inference rule that from:
> 
> <person rdf:ID="A">
>     <hasBrother>
>         <person>
>             <hasDaughter rdf:resource="#C"/>
>         </person>
>     </hasBrother>
> </person>
> 
> follows:
> 
> <person rdf:ID="A">
>     <hasNiece rdf:resource="#C">
> </person>
> 
> In other words:
> 
> {hasNiece} = {hasBrother X hasDaughter}
> 
> I had been pondering over this for some time
> and could not find an answer neither myself nor by asking some other
> people.
> 
> Thanks,
> 
> --Nikita.
<?xml version="1.0"?>

<RDF
  xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:relatives="this#">


<Property rdf:ID="hasDaugther">
        <rdfs:isDefinedAs rdf:parseType="Literal">
        hasDaugther(X,Y) :-
                P = hasDaughter, statement(X,P,Y).
        </rdfs:isDefinedAs>
</Property>

<Property rdf:ID="hasSon">
        <rdfs:isDefinedAs rdf:parseType="Literal">
        hasSon(X,Y) :-
                P = hasSon, statement(X,P,Y).
        </rdfs:isDefinedAs>
</Property>

<Property rdf:ID="hasSister">
        <rdfs:isDefinedAs rdf:parseType="Literal">
        hasSister(X,Y) :-
                P = hasSister, statement(X,P,Y).
        </rdfs:isDefinedAs>
</Property>

<Property rdf:ID="hasBrother">
        <rdfs:isDefinedAs rdf:parseType="Literal">
        hasBrother(X,Y) :-
                P = hasBrother, statement(X,P,Y).
           </rdfs:isDefinedAs>
</Property>


<Property rdf:ID="hasNice">
	<rdfs:isDefinedAs rdf:parseType="Literal">
	<![CDATA[
	hasNiece(X,Y) :- hNiece(X,Y),
		format('<person rdf:ID="~p">~n   <hasNiece rdf:resource="~p"/> ~n</person>',[X,Y]).
	hNiece(X,Y) :-
		hasBrother(X,Z), hasDaugther(Z,Y).
        hNiece(X,Y) :-
                hasSister(X,Z), hasDaugther(Z,Y).
	]]>
           </rdfs:isDefinedAs>
</Property>

<relatives:person rdf:ID="A">
    <relatives:hasBrother>
        <relatives:person>
            <relatives:hasDaughter rdf:resource="#C"/>
        </relatives:person>
    </relatives:hasBrother>
</relatives:person>
</RDF>
Received on Monday, 5 November 2001 13:50:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:52 GMT