You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Claude Warren <cl...@xenei.com> on 2015/04/28 23:47:15 UTC

filegraph error?

I'm not sure this is an error so I thought I'd see what the consensus is
here before I do anything.

My understanding is that the Graph interface has no restrictions on the
types of objects in the subject, predicate or object.  That is that I could
store an anonymous node as the predicate in a triple even though this is
not allowed in a model.

The FileGraph implementation uses a model internally and when it writes the
data out the model restrictions seem to apply -- that is I can not store an
anonymous node as a predicate.

All other graphs tested thus far allow saving the anonymous node as a
predicate.

It may be that the format of the output is enforcing the restrictions.  I
am currently using a TURTLE format.  However any functional format would be
acceptable.  Is there a way to write the filegraph output when the graph
does not meet the model restrictions?

Claude

-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: filegraph error?

Posted by Andy Seaborne <an...@apache.org>.
On 28/04/15 22:47, Claude Warren wrote:
> I'm not sure this is an error so I thought I'd see what the consensus is
> here before I do anything.
>
> My understanding is that the Graph interface has no restrictions on the
> types of objects in the subject, predicate or object.  That is that I could
> store an anonymous node as the predicate in a triple even though this is
> not allowed in a model.
>
> The FileGraph implementation uses a model internally and when it writes the
> data out the model restrictions seem to apply -- that is I can not store an
> anonymous node as a predicate.
>
> All other graphs tested thus far allow saving the anonymous node as a
> predicate.
>
> It may be that the format of the output is enforcing the restrictions.  I
> am currently using a TURTLE format.  However any functional format would be
> acceptable.  Is there a way to write the filegraph output when the graph
> does not meet the model restrictions?
>
> Claude

Short answer: no, not without some work but it's not a lot of work.

The fact that triples allow generalized RDF [1] (anon predicates etc) is 
needed because they arise in rules and SPARQL.

It would be a burden to be forever testing before making a triple or 
pattern, rather, they are allowed then don't match naturally or get 
filtered out (CONSTRUCT).

Generalised graphs are less needed as far as I know.

None of the I/O will write generalized RDF though it's not hard (except 
for RDF/XML where it's impossible). It all assumes RDF not generalized.

The NT writer doesn't even check but the NT read does as does the parser 
to graph step.  Some of the other I/O would work (SSE, DataBags). 
Writing generalized-NT I/O is trivial; Turtle is less so as it's about 
pretty forms.

	Andy

[1] http://www.w3.org/TR/rdf11-concepts/#section-generalized-rdf

Re: filegraph error?

Posted by Rob Vesse <rv...@dotnetrdf.org>.
For your specific case no I don't think so

No RDF serialisation (other than possibly our non-standard RDF/Thrift)
allows for anonymous predicates so this would fail regardless of the
underlying serialisation AFAIK

Rob

On 28/04/2015 22:47, "Claude Warren" <cl...@xenei.com> wrote:

>I'm not sure this is an error so I thought I'd see what the consensus is
>here before I do anything.
>
>My understanding is that the Graph interface has no restrictions on the
>types of objects in the subject, predicate or object.  That is that I
>could
>store an anonymous node as the predicate in a triple even though this is
>not allowed in a model.
>
>The FileGraph implementation uses a model internally and when it writes
>the
>data out the model restrictions seem to apply -- that is I can not store
>an
>anonymous node as a predicate.
>
>All other graphs tested thus far allow saving the anonymous node as a
>predicate.
>
>It may be that the format of the output is enforcing the restrictions.  I
>am currently using a TURTLE format.  However any functional format would
>be
>acceptable.  Is there a way to write the filegraph output when the graph
>does not meet the model restrictions?
>
>Claude
>
>-- 
>I like: Like Like - The likeliest place on the web
><http://like-like.xenei.com>
>LinkedIn: http://www.linkedin.com/in/claudewarren





Re: filegraph error?

Posted by Claude Warren <cl...@xenei.com>.
The short answer is that the filegraph does not meet the contract of the
Graph interface.

On Wed, Apr 29, 2015 at 1:14 PM, Andy Seaborne <an...@apache.org> wrote:

> On 29/04/15 07:06, Claude Warren wrote:
>
>> Information I should have provided:
>>
>> The error occurs at:
>>
>> Caused by: java.lang.NullPointerException: null
>>      at
>>
>> org.apache.jena.n3.N3JenaWriterPP.preparePropertiesForSubject(N3JenaWriterPP.java:257)
>>
>
> FYI - that is the old Turtle-writer and is to be retired.
>
> The RIOT one won't work either.
>
>         Andy
>
>
>> at that line we find
>> if ( p.getURI().startsWith(RDF.getURI()) ||
>>
>> since "p" is an anonymous node the getURI() returns null.
>>
>> Claude
>>
>> On Tue, Apr 28, 2015 at 10:47 PM, Claude Warren <cl...@xenei.com> wrote:
>>
>>  I'm not sure this is an error so I thought I'd see what the consensus is
>>> here before I do anything.
>>>
>>> My understanding is that the Graph interface has no restrictions on the
>>> types of objects in the subject, predicate or object.  That is that I
>>> could
>>> store an anonymous node as the predicate in a triple even though this is
>>> not allowed in a model.
>>>
>>> The FileGraph implementation uses a model internally and when it writes
>>> the data out the model restrictions seem to apply -- that is I can not
>>> store an anonymous node as a predicate.
>>>
>>> All other graphs tested thus far allow saving the anonymous node as a
>>> predicate.
>>>
>>> It may be that the format of the output is enforcing the restrictions.  I
>>> am currently using a TURTLE format.  However any functional format would
>>> be
>>> acceptable.  Is there a way to write the filegraph output when the graph
>>> does not meet the model restrictions?
>>>
>>> Claude
>>>
>>> --
>>> I like: Like Like - The likeliest place on the web
>>> <http://like-like.xenei.com>
>>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>>
>>>
>>
>>
>>
>


-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: filegraph error?

Posted by Andy Seaborne <an...@apache.org>.
On 29/04/15 07:06, Claude Warren wrote:
> Information I should have provided:
>
> The error occurs at:
>
> Caused by: java.lang.NullPointerException: null
>      at
> org.apache.jena.n3.N3JenaWriterPP.preparePropertiesForSubject(N3JenaWriterPP.java:257)

FYI - that is the old Turtle-writer and is to be retired.

The RIOT one won't work either.

	Andy

>
> at that line we find
> if ( p.getURI().startsWith(RDF.getURI()) ||
>
> since "p" is an anonymous node the getURI() returns null.
>
> Claude
>
> On Tue, Apr 28, 2015 at 10:47 PM, Claude Warren <cl...@xenei.com> wrote:
>
>> I'm not sure this is an error so I thought I'd see what the consensus is
>> here before I do anything.
>>
>> My understanding is that the Graph interface has no restrictions on the
>> types of objects in the subject, predicate or object.  That is that I could
>> store an anonymous node as the predicate in a triple even though this is
>> not allowed in a model.
>>
>> The FileGraph implementation uses a model internally and when it writes
>> the data out the model restrictions seem to apply -- that is I can not
>> store an anonymous node as a predicate.
>>
>> All other graphs tested thus far allow saving the anonymous node as a
>> predicate.
>>
>> It may be that the format of the output is enforcing the restrictions.  I
>> am currently using a TURTLE format.  However any functional format would be
>> acceptable.  Is there a way to write the filegraph output when the graph
>> does not meet the model restrictions?
>>
>> Claude
>>
>> --
>> I like: Like Like - The likeliest place on the web
>> <http://like-like.xenei.com>
>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>
>
>
>


Re: filegraph error?

Posted by Claude Warren <cl...@xenei.com>.
Information I should have provided:

The error occurs at:

Caused by: java.lang.NullPointerException: null
    at
org.apache.jena.n3.N3JenaWriterPP.preparePropertiesForSubject(N3JenaWriterPP.java:257)

at that line we find
if ( p.getURI().startsWith(RDF.getURI()) ||

since "p" is an anonymous node the getURI() returns null.

Claude

On Tue, Apr 28, 2015 at 10:47 PM, Claude Warren <cl...@xenei.com> wrote:

> I'm not sure this is an error so I thought I'd see what the consensus is
> here before I do anything.
>
> My understanding is that the Graph interface has no restrictions on the
> types of objects in the subject, predicate or object.  That is that I could
> store an anonymous node as the predicate in a triple even though this is
> not allowed in a model.
>
> The FileGraph implementation uses a model internally and when it writes
> the data out the model restrictions seem to apply -- that is I can not
> store an anonymous node as a predicate.
>
> All other graphs tested thus far allow saving the anonymous node as a
> predicate.
>
> It may be that the format of the output is enforcing the restrictions.  I
> am currently using a TURTLE format.  However any functional format would be
> acceptable.  Is there a way to write the filegraph output when the graph
> does not meet the model restrictions?
>
> Claude
>
> --
> I like: Like Like - The likeliest place on the web
> <http://like-like.xenei.com>
> LinkedIn: http://www.linkedin.com/in/claudewarren
>



-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren