OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] patterns vs. identifiers

[ Lists Home | Date Index | Thread Index ]

"Simon St.Laurent" wrote:
> 

I don't see the distinction you're making. I see RDF and the other
semantic web technologies as fundamentally about pattern matching. IMHO,
they exist primarily to help programs pattern match.

It happens to work at a higher level of abstraction than XML pattern
matching technologies. Also, RDF's XML syntax adds another layer of
indirection. But consider the pattern matching that's going on in the
following RDF/N3 data. I haven't declared any uncles or nephews (and not
all of the brother relationships) but based on patterns, the
implementation figures out the rest. You could have various complaints
about RDF but that it lacks pattern matching is not one of them. (well

@prefix : <IsUncle#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix string:  <http://www.w3.org/2000/10/swap/string#> .

:Joe  has :father  :Fred.
:Jim  has :father :Fred. # and therefore brother Joe!

:Fred has :brother :Frank.
:Fred has :brother :Franz.
:Franz has :brother :Frank. # and therefore brother Fred!

# if "X" has a father "Y" with a brother "Z", 
# "X" is "Z"'s uncle
this log:forAll :who1, :who2, :who3, :out.
{ :who1 has :father [ has :brother :who2 ] } log:implies 
        { :who1 has :uncle :who2 }.

# if "X" has a brother "Y" and "Y" is a brother "Z"
# "X" and "Z" are brothers unless "X"="Z"
{ :who1 has :brother [ has :brother :who2] .
    :who1 log:notEqualTo :who2 
} log:implies { :who1 has :brother :who2 }.


# if "X" has a brother "Y"
# "Y" has a brother "X" 
# (you are your brother's brother)
{ :who1 has :brother :who2 
} log:implies { :who2 has :brother :who1 }.

# if "X" has an uncle "Y", 
# "Y" has a nephew "X"
{ :who1 has :uncle :who2}
    log:implies {:who2 has :nephew :who1}.

# if we have the same father, we have the same brother
{ :who1 has :father :who3 . :who2 has :father :who3. } 
    log:implies { :who1 has :brother :who2 }.

:Joe has :name "Joseph".
:Jim has :name "Jimmy".
:Fred has :name "Fredrick".
:Franz has :name "Franz".
:Frank has :name "Frank".

# print out everyone's nephews
{ :who1 has :nephew :who2 . 
        ([is :name of :who1] " has nephew " [is :name of :who2] "\n") 
            string:concatenation :out}
    log:implies { :who1 log:outputString :out} .

# print out everyone's brothers
{ :who1 has :brother :who2 . 
        ([is :name of :who1] " has brother " [is :name of :who2] "\n") 
            string:concatenation :out}
    log:implies { :who1 log:outputString :out} .

# print out everyone's uncles
{ :who1 has :uncle :who2 . 
        ([is :name of :who1] " has uncle " [is :name of :who2] "\n") 
            string:concatenation :out}
    log:implies { :who1 log:outputString :out} .

-- 
"When I walk on the floor for the final execution, I'll wear a denim 
suit. I'll walk in there like Willie Nelson, John Wayne, Will Smith 
-- Men in Black -- James Brown. Maybe do a Michael Jackson moonwalk."
Congressman James Traficant.




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS