RE: comparing XML and RDF data models

I think it is also interesting to make a comparison with SQL and RDBMS,
which sets a pretty high bar for query languages. 

One of the great strengths of SQL/RDBMS is *views*. These shield users
(SQL queries) from changes in the underlying schema. I think this would
have a particular application and relevance in the XML/RDF world,
because views could shield users from the complexity and immovability of
namespaces. IMO there is a strong case for storing XML/RDF data with no
namespaces, and add namespace information in views. 

I expect this has already been thought of - are there any
implementations out there?

Tim.

 
 

-----Original Message-----
From: semantic-web-request@w3.org [mailto:semantic-web-request@w3.org]
On Behalf Of Maciej Gawinecki
Sent: 01 July 2008 11:21
To: semantic-web@w3.org
Subject: comparing XML and RDF data models


In one of the article comparing two data models: XML and RDF I found a
statement stating that (I'm loosely citing from my memory):

   Searching XML with XPath query expression is easy if you know the
   schema of the document being quiried. However, the same query will
not
   work any a document, which is differently structured, but contains
   equivalent information. This can be solved by usage of RDF model,
   which can be then queried with RDQL or SPARQL query.

Is that really true, that XPath-based XML search is limited due to its
structure? Yes, that's why there is a great research on keyword-based
quering of XML documents (not knowing schema in advance). But is it RDF
really better for this issue ?

I will try to give a few example what I exactly mean. [Of course, I'm
ommiting here the problem of knowning the name a tag/property/resource,
only the structure can be different.] Let's see two XML documents:

   <Sensor>
     <name>Sensor220</name>
     <isLocatedNearBy>
       <Road>
         E330
       </Road>
     <isLocatedNearBy>
   </Sensor>

Here road value can be check through XPath expression: 
\\Sensor\isLocatedNearBy\Road

And let's see differently structured document (road defined by name
property)

   <Sensor>
     <name>Sensor220</name>
     <isLocatedNearBy>
       <Road>
         <name>E330</name>
       </Road>
     <isLocatedNearBy>
   </Sensor>

With XPath expression: \\Sensor\isLocatedNearBy\Road\name

Or yet another one (road is ancestor tag to the sensor tag, not the
oposite)

   <Road>
     <name>E330</name>
     <hasSensor>
       <Sensor>
         <name>Sensor 220</name>
       </Sensor>
     </hasSensor>
   </Road>

XPath: \\Road\name

The same problem would be with RDF. Let see the first model

   :Sensor220 :isLocatedNearBy :Road_E330 .

WHERE clause of SPARQL query would be then like a

   ?s :isLocatedNearBy :Road_E330 .

For other version we define a road with a specific value of hasName
property:

   :Sensor220 :isLocatedNearBy :RoadXXX .
   :RoadXXX :hasName "E330" .

the SPARQL query part:

   ?s :isLocatedNearBy ?r .
   ?r :hasName "E330" .

or by analogy to the third XML representation (road "has" a sensor, not
the opposite):

   :RoadXXX :hasName "E330" .
   :RoadXXX :hasSensor :Sensor220 .

the SPARQL query part:

   ?r :hasName "E330" .
   ?r :hasSensor ?s .

Can someone comment it ?

Thanks,
Maciej

Received on Tuesday, 1 July 2008 13:34:32 UTC