You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Benson Margulies <bi...@gmail.com> on 2010/12/26 18:56:19 UTC
Hoping for smaller turtle(s)
I'm sure I'm missing something basic here as usual. Notice that I'm
getting the full URI in spite of having defined a prefix. What's
special about my URI that defeats the prefix factoring?
@prefix blob: <uri:jug:001f469cc17412da1ce53fa1f9b67481#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rex: <http://www.basistech.com/ontologies/2010/6/rex.owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<uri:jug:001f469cc17412da1ce53fa1f9b67481#12>
a rex:Organization ;
rex:hasEntityDetectionSource
"statistical" ;
rex:hasNormalizedText
"Taliban" ;
rex:hasOriginalText "Taliban" .
Re: Hoping for smaller turtle(s)
Posted by Benson Margulies <bi...@gmail.com>.
You might like XML better if you parsed it with woodstox, let alone
used the FIS representation.
On Sun, Dec 26, 2010 at 3:04 PM, Andy Seaborne <an...@gmail.com> wrote:
>
>
> On 26/12/10 19:17, Benson Margulies wrote:
>>
>> Meanwhile, did you see my message about FastInfoset? Hypothetically,
>> XML+FastInfoset might prove convenient this "I need to move a lot of
>> RDF around."
>
> Could do - interesting experiment to do. Adding new readers/writers is
> possible (but tricky currently - work-in-progress).
>
> The fastest and most scalable way to deal with RDF is usually to print and
> load as N-triples. Compressed N-Triples is typically x8.
>
> The pretty printing Turtle is slow because it has to analysis the model for
> structures and track all statements written. N-triples just raw writes the
> DB. It does not scale to very large models.
>
> XML has proven costly to parse - N-triples is really close to just byte
> shifting.
>
> TDB loads fastest from .nt or .nt.gz (or .nq and .nq.gz).
>
> Andy
>
Re: Hoping for smaller turtle(s)
Posted by Andy Seaborne <an...@gmail.com>.
On 26/12/10 19:17, Benson Margulies wrote:
> Meanwhile, did you see my message about FastInfoset? Hypothetically,
> XML+FastInfoset might prove convenient this "I need to move a lot of
> RDF around."
Could do - interesting experiment to do. Adding new readers/writers is
possible (but tricky currently - work-in-progress).
The fastest and most scalable way to deal with RDF is usually to print
and load as N-triples. Compressed N-Triples is typically x8.
The pretty printing Turtle is slow because it has to analysis the model
for structures and track all statements written. N-triples just raw
writes the DB. It does not scale to very large models.
XML has proven costly to parse - N-triples is really close to just byte
shifting.
TDB loads fastest from .nt or .nt.gz (or .nq and .nq.gz).
Andy
Re: Hoping for smaller turtle(s)
Posted by Benson Margulies <bi...@gmail.com>.
Meanwhile, did you see my message about FastInfoset? Hypothetically,
XML+FastInfoset might prove convenient this "I need to move a lot of
RDF around."
Re: Hoping for smaller turtle(s)
Posted by Benson Margulies <bi...@gmail.com>.
GZIP is next after fixing the URIs.
Also, I have some literals that are long and come around over and
over, so factoring them out to their own triples is on the agenda.
On Sun, Dec 26, 2010 at 1:47 PM, Andy Seaborne
<an...@epimorphics.com> wrote:
> Write to a gzip'ed stream?
>
> Andy
>
> On 26/12/10 18:36, Benson Margulies wrote:
>>
>> Note that the goal here is to persuade the Turtle writer to make small
>> Turtles from a model.
>>
>> On Sun, Dec 26, 2010 at 1:18 PM, Andy Seaborne<an...@gmail.com>
>> wrote:
>>>
>>> Ian's correct - the local part can't start with a digit. It's part of the
>>> turtle space.
>>>
>>> In terms of writing Turtle by hand:
>>>
>>> @base<uri:jug:001f469cc17412da1ce53fa1f9b67481> .
>>>
>>> <#12>
>>> a rex:Organization ;
>>> ...
>>>
>>> works but the writer isn't clever enough to use a base in the file (@base
>>> does not survive parsing). If you write it with that base, it might
>>> work.
>>>
>>>
>>> In design terms, it's a completely unnessary restriction. It's not a XML
>>> QNAME or related to it any more.
>>>
>>> Long version:
>>> http://seaborne.blogspot.com/2010/06/standardising-rdf-syntaxes.html
>>>
>>> SPARQL does not have this restriction because the last working group got
>>> pushback not to follow Turtle exactly here, especially from communities
>>> using URNs generated from existing systems ....
>>>
>>> Hopefully, the next RDF WG will do the right thing.
>>>
>>> Andy
>>>
>>> On 26/12/10 18:08, Ian Dickinson wrote:
>>>>
>>>> I should have added:
>>>>
>>>>> blob:12
>>>>> probably won't parse as you expect
>>>>
>>>> and therefore the writer is smart enough not to generate it.
>>>>
>>>> Ian
>>>
>
Re: Hoping for smaller turtle(s)
Posted by Andy Seaborne <an...@epimorphics.com>.
Write to a gzip'ed stream?
Andy
On 26/12/10 18:36, Benson Margulies wrote:
> Note that the goal here is to persuade the Turtle writer to make small
> Turtles from a model.
>
> On Sun, Dec 26, 2010 at 1:18 PM, Andy Seaborne<an...@gmail.com> wrote:
>> Ian's correct - the local part can't start with a digit. It's part of the
>> turtle space.
>>
>> In terms of writing Turtle by hand:
>>
>> @base<uri:jug:001f469cc17412da1ce53fa1f9b67481> .
>>
>> <#12>
>> a rex:Organization ;
>> ...
>>
>> works but the writer isn't clever enough to use a base in the file (@base
>> does not survive parsing). If you write it with that base, it might work.
>>
>>
>> In design terms, it's a completely unnessary restriction. It's not a XML
>> QNAME or related to it any more.
>>
>> Long version:
>> http://seaborne.blogspot.com/2010/06/standardising-rdf-syntaxes.html
>>
>> SPARQL does not have this restriction because the last working group got
>> pushback not to follow Turtle exactly here, especially from communities
>> using URNs generated from existing systems ....
>>
>> Hopefully, the next RDF WG will do the right thing.
>>
>> Andy
>>
>> On 26/12/10 18:08, Ian Dickinson wrote:
>>>
>>> I should have added:
>>>
>>>> blob:12
>>>> probably won't parse as you expect
>>>
>>> and therefore the writer is smart enough not to generate it.
>>>
>>> Ian
>>
Re: Hoping for smaller turtle(s)
Posted by Benson Margulies <bi...@gmail.com>.
Note that the goal here is to persuade the Turtle writer to make small
Turtles from a model.
On Sun, Dec 26, 2010 at 1:18 PM, Andy Seaborne <an...@gmail.com> wrote:
> Ian's correct - the local part can't start with a digit. It's part of the
> turtle space.
>
> In terms of writing Turtle by hand:
>
> @base <uri:jug:001f469cc17412da1ce53fa1f9b67481> .
>
> <#12>
> a rex:Organization ;
> ...
>
> works but the writer isn't clever enough to use a base in the file (@base
> does not survive parsing). If you write it with that base, it might work.
>
>
> In design terms, it's a completely unnessary restriction. It's not a XML
> QNAME or related to it any more.
>
> Long version:
> http://seaborne.blogspot.com/2010/06/standardising-rdf-syntaxes.html
>
> SPARQL does not have this restriction because the last working group got
> pushback not to follow Turtle exactly here, especially from communities
> using URNs generated from existing systems ....
>
> Hopefully, the next RDF WG will do the right thing.
>
> Andy
>
> On 26/12/10 18:08, Ian Dickinson wrote:
>>
>> I should have added:
>>
>>> blob:12
>>> probably won't parse as you expect
>>
>> and therefore the writer is smart enough not to generate it.
>>
>> Ian
>
Re: Hoping for smaller turtle(s)
Posted by Andy Seaborne <an...@gmail.com>.
Ian's correct - the local part can't start with a digit. It's part of
the turtle space.
In terms of writing Turtle by hand:
@base <uri:jug:001f469cc17412da1ce53fa1f9b67481> .
<#12>
a rex:Organization ;
...
works but the writer isn't clever enough to use a base in the file
(@base does not survive parsing). If you write it with that base, it
might work.
In design terms, it's a completely unnessary restriction. It's not a
XML QNAME or related to it any more.
Long version:
http://seaborne.blogspot.com/2010/06/standardising-rdf-syntaxes.html
SPARQL does not have this restriction because the last working group got
pushback not to follow Turtle exactly here, especially from communities
using URNs generated from existing systems ....
Hopefully, the next RDF WG will do the right thing.
Andy
On 26/12/10 18:08, Ian Dickinson wrote:
> I should have added:
>
>> blob:12
>> probably won't parse as you expect
> and therefore the writer is smart enough not to generate it.
>
> Ian
Re: Hoping for smaller turtle(s)
Posted by Ian Dickinson <i....@gmail.com>.
I should have added:
> blob:12
> probably won't parse as you expect
and therefore the writer is smart enough not to generate it.
Ian
Re: Hoping for smaller turtle(s)
Posted by Ian Dickinson <i....@gmail.com>.
On Sun, Dec 26, 2010 at 5:56 PM, Benson Margulies <bi...@gmail.com> wrote:
> I'm sure I'm missing something basic here as usual. Notice that I'm
> getting the full URI in spite of having defined a prefix. What's
> special about my URI that defeats the prefix factoring?
>
> @prefix blob: <uri:jug:001f469cc17412da1ce53fa1f9b67481#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix rex: <http://www.basistech.com/ontologies/2010/6/rex.owl#> .
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> @prefix owl: <http://www.w3.org/2002/07/owl#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>
> <uri:jug:001f469cc17412da1ce53fa1f9b67481#12>
> a rex:Organization ;
> rex:hasEntityDetectionSource
> "statistical" ;
> rex:hasNormalizedText
> "Taliban" ;
> rex:hasOriginalText "Taliban" .
Andy knows the Turtle grammar better than I do, but at a guess the
problem isn't the prefix it's the local name part:
blob:12
probably won't parse as you expect because 12 will be recognised by
the lexical analyser as a number, not as part of a URI. I would hazard
that:
<uri:jug:001f469cc17412da1ce53fa1f9b67481#node12>
would give you the kind of output you expect, but I haven't tried it
and could easily be wrong.
Ian