[
https://issues.apache.org/jira/browse/JENA-1855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17055969#comment-17055969
]
Andy Seaborne commented on JENA-1855:
-------------------------------------
Creates JENA-1857 for the {{.size()}} issue.
Test examples for this issue: the two ways to get raw parser output show the
problem.
It looks like (to me, ATM) that {{LangTriG}} needs a simple fix and that NQ
parsing is correct.
{code:java}
public static void main(String...a) {
// One triple, default graph.
dwim("/home/afs/tmp/D.trig");
dwim("/home/afs/tmp/D.nq");
}
public static void dwim(String dataFilename) {
System.out.println("== Data: "+dataFilename);
System.out.println();
// NQ: urn:x-arq:DefaultGraphNode
// TriG: null
{
System.out.println("RDFDataMgr.createIteratorQuads");
Lang lang = RDFLanguages.filenameToLang(dataFilename);
Iterator<Quad> it =
RDFDataMgr.createIteratorQuads(IO.openFile(dataFilename), lang, null);
while (it.hasNext()) {
Quad q = it.next();
System.out.println(q.getGraph());
}
System.out.println();
}
// NQ: urn:x-arq:DefaultGraphNode
// TriG: null
{
System.out.println("RDFDataMgr.parse");
StreamRDF dest = new StreamRDFBase() {
@Override
public void quad(Quad quad) {
System.out.println(quad.getGraph());
}
};
RDFDataMgr.parse(dest, dataFilename);
System.out.println();
}
}
{code}
> TRIG parser yields NULL-graph for quads in default graph
> --------------------------------------------------------
>
> Key: JENA-1855
> URL: https://issues.apache.org/jira/browse/JENA-1855
> Project: Apache Jena
> Issue Type: Bug
> Components: RIOT
> Affects Versions: Jena 3.14.0
> Reporter: Claus Stadler
> Assignee: Andy Seaborne
> Priority: Major
>
> Hi Jena Team and Andy, thanks for all your great work on Jena and fixing all
> my recent issues, but I found another one :)
> The Trig Parser yields quads with a null value in the graph component for
> data in the default graph. It should be Quad.defaultGraphNodeGenerated.
> Test data:
> {code}
> # test.trig
> @base <http://www.example.org/base-> .
> @prefix : <http://www.example.org/prefx-> .
> <s> <p> <o> .
> :x :y :z .
> {code}
> {code:java}
> Iterator<Quad> it =
> RDFDataMgr.createIteratorQuads(RDFDataMgr.open("test.trig"), Lang.TRIG, null);
> while(it.hasNext()) {
> Quad q = it.next();
> System.out.println(q.getGraph());
> }
> {code}
> {code}
> null
> null
> {code}
> This causes quite unexpected null pointer exceptions, such as in this simple
> scenario:
> {code}
> Dataset ds = RDFDataMgr.loadDataset("test.trig");
> System.out.println(ds.asDatasetGraph().size());
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)