[redland-dev] Parsing RDF

Richard Newman r.newman at reading.ac.uk
Wed Dec 14 19:50:35 GMT 2005


> Perhaps I should explain myself a little clearer.  Lets suppose  
> that we had
> two ontology definitions in a single RDF file.  Some of the triples  
> would
> belong to one ontology and some of the triples would belong to the  
> other
> ontology.

Triples do not "belong" to an ontology. It's better if you utterly  
forget about files; they aren't meaningful on the Semantic Web,  
really. It's one big graph. Likewise, there aren't really two  
"ontologies". It's one graph.

Redland, along with other RDF systems, often stores a 'source' field  
in a triple. If you really want to keep track of where a triple came  
from, then this is where to look. It's at the granularity of "from  
which URL was this triple retrieved?".

> What is the correct way of determining what triples belong to
> which ontology?  Sometimes it seems there are multiple definitions of
> ontologies in the same RDF file, so I'm not certain that the last  
> one is
> always the one that should be used as the overall context for the  
> triples.

"it seems"
Well, if you can't tell them apart, how on earth is an RDF store  
supposed to?

> Also, since the Ontology definition
> (http://www.w3.org/1999/02/22-rdf-syntax-ns#type) usually comes  
> last, I'm
> not sure how I can determine what ontology the triples reside in  
> (to set the
> context) without doing 2 passes of the RDF file.  I would have  
> thought that
> the ontology definition would come first, and then I would  
> immediately set
> that as the context, but it appears like the parser is actually  
> parsing the
> file in reverse, from the end to the beginning??  Clearly there is  
> some
> concept I am missing, or I have a deep misunderstanding of something.

You have a deep misunderstanding.

The Semantic Web is *just triples*. Forget about RDF/XML, it's just  
syntax. Dump your files into n-triples; this is the closest you'll  
get to the RDF model.

x p y
y p z
a r g

are *all* you have to work with, if you're operating wholly within RDF.

Notice that there is no concept of a containing ontology, or of a file.

So, the better question is -- why are you trying to figure out in  
which 'ontology' a triple 'belongs'?

-R


More information about the redland-dev mailing list