[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: patterns vs. identifiers


log outputstring
"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.

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.