Thanks Andy,
For now, I've been adding the prefixes to the incoming RDF stream
and it works fine. I was just curious if the behavior was by design. I
re-read the Turtle spec:
http://www.w3.org/TR/turtle/
and there is a note in it that says:
"This specification does not define how Turtle parsers handle
non-conforming input documents."
It would have been handy if Jena Model had assumed it's current loaded
prefixes when they weren't defined in the imported data since I stream
RDF in my programs between systems. It would have made for more compact
transmission of data.
- Erich
Erich Bremer
http://www.ebremer.com
On 4/7/2013 3:21 PM, Andy Seaborne wrote:
On 07/04/13 18:45, Erich Bremer wrote:
Hi,
I have a jena 2.10.0 Model and when I import a fully-formed turtle
document everything works great. The triples are added and the prefixes
for the Model are created from the imported data. However, if I define
my prefixes first in the Model, and then import the same turtle document
in, but, with imported document's prefix definitions removed, the import
fails. Should it fail? Or would it make more sense that if there are
matching prefixes, that it would use the pre-defined prefixes of the
model? - Erich
Erich Bremer
http://www.ebremer.com
Erich,
A parsed file has be a complete and self contained graph serialization
so it does need the prefixes in the file. Turtle is not defined for
fragments.
(You could create the Turtle parser directly and add the prefix
mappings before it's called but you are essentially creating a
fragment parser - the data isn't portable. You could also prepend the
prefixes to the stream somehow.)
Andy