I think the only option is to use cli tools such as sed to strip the graph name 
from nquads, so basically you convert to nt then you strip out graph names with 
sed. I also had the same problem and asked for some kind of --ignore-graph flag 
in riot and other jena tools, but IIRC the answer was to use sed or some other 
cli tools. It's rather cumbersome but that's the way it is, unless somebody 
implements it.

 
 

Sent: Sunday, November 11, 2018 at 11:00 AM
From: "Martynas Jusevičius" <[email protected]>
To: jena-users-ml <[email protected]>
Subject: Re: Converting TriX to N-Quads with riot
I'm on Jena 3.9.0 now.

While we're at it, can you explain how to convert TriX, or at least
N-Quads, to N-Triples by stripping named graphs? I tried

riot --nocheck --out=nt KORT10.1.nq
riot --nocheck --out=nt KORT10.1.trix

Neither produced any output.

The reason is that my end goal is HDT, which currently does not support graphs.
On Sat, Nov 10, 2018 at 6:22 PM Andy Seaborne <[email protected]> wrote:
>
>
>
> On 10/11/2018 17:15, Andy Seaborne wrote:
> > Works for me.
> >
> > $ riot --syntax=TriX t.xml
> > <http://example.org/s> <http://example.org/p[http://example.org/p]> 
> > <http://example.org/o[http://example.org/o]> .
> >
> > v3.9.0
> >
> > (this is reminiscent of an old bug)
>
> JENA-1535
> Bug in 3.4 to 3.7
> Fixed in 3.8.0
>
>
>
> >
> > Andy
> >
> > t.xml:
> > ----------------------------
> > <TriX>
> > <graph>
> > <triple>
> > <uri>http://example.org/s[http://example.org/s]</uri>
> > <uri>http://example.org/p[http://example.org/p]</uri>
> > <uri>http://example.org/o[http://example.org/o]</uri>
> > </triple>
> > </graph>
> > </TriX>
> >
> >
> > On 10/11/2018 15:16, ajs6f wrote:
> >> Please file a ticket for this, with a file that shows the problem and
> >> a complete invocation that fails.
> >>
> >> ajs6f
> >>
> >>> On Nov 10, 2018, at 10:04 AM, Martynas Jusevičius
> >>> <[email protected]> wrote:
> >>>
> >>> Yes, .as I wrote, without --syntax and with .trix extension it works.
> >>> On Sat, Nov 10, 2018 at 3:51 PM ajs6f <[email protected]> wrote:
> >>>>
> >>>> Just as an experiment, can you verify that changing the extensions
> >>>> to .trix and removing the --syntax flag works?
> >>>>
> >>>> ajs6f
> >>>>
> >>>>> On Nov 10, 2018, at 9:49 AM, Martynas Jusevičius
> >>>>> <[email protected]> wrote:
> >>>>>
> >>>>> There are some issues with non-canonical XMLLiterals, but in principle
> >>>>> the files parse.
> >>>>>
> >>>>> I think --syntax TriX doesn't work though, as it throws RDF/XML
> >>>>> related errors.
> >>>>> On Sat, Nov 10, 2018 at 3:32 PM Laura Morales <[email protected]>
> >>>>> wrote:
> >>>>>>
> >>>>>> It should yes. Maybe you have some errors in your file? Did you
> >>>>>> try riot --validate yourfile.xml? Maybe you missed the
> >>>>>> xmlns="http://www.w3.org/2004/03/trix/trix-1/";?
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> Sent: Saturday, November 10, 2018 at 3:19 PM
> >>>>>> From: "Martynas Jusevičius" <[email protected]>
> >>>>>> To: jena-users-ml <[email protected]>
> >>>>>> Subject: Re: Converting TriX to N-Quads with riot
> >>>>>> Laura's example seems to work, but I thought --syntax should override
> >>>>>> the file extension?
> >>>>>> On Sat, Nov 10, 2018 at 3:17 PM ajs6f <[email protected]> wrote:
> >>>>>>>
> >>>>>>> I'd have to go check the code, but Martynas, possibly the file
> >>>>>>> extensions are tripping you up?
> >>>>>>>
> >>>>>>> ajs6f
> >>>>>>>
> >>>>>>>> On Nov 10, 2018, at 9:10 AM, Laura Morales <[email protected]>
> >>>>>>>> wrote:
> >>>>>>>>
> >>>>>>>> Using the TriX file here
> >>>>>>>> http://www.hpl.hp.com/techreports/2004/HPL-2004-56.pdf[http://www.hpl.hp.com/techreports/2004/HPL-2004-56.pdf]
> >>>>>>>>  on page 3
> >>>>>>>> as an example it works for me:
> >>>>>>>>
> >>>>>>>> 1. copy content to a file example.trix
> >>>>>>>> 2. riot --validate example.trix
> >>>>>>>> 3. riot --output nq example.trix
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> Sent: Saturday, November 10, 2018 at 2:31 PM
> >>>>>>>>> From: "Martynas Jusevičius" <[email protected]>
> >>>>>>>>> To: jena-users-ml <[email protected]>
> >>>>>>>>> Subject: Converting TriX to N-Quads with riot
> >>>>>>>>>
> >>>>>>>>> Hi,
> >>>>>>>>>
> >>>>>>>>> I have some large TriX files that I want to convert to N-Quads
> >>>>>>>>> from
> >>>>>>>>> command line (and later on to RDF HDT).
> >>>>>>>>>
> >>>>>>>>> The files validate against the TriX XML schema, so I assume
> >>>>>>>>> they're good.
> >>>>>>>>> I couldn't find a standalone trix script in the /bin folder, so
> >>>>>>>>> I tried
> >>>>>>>>>
> >>>>>>>>> riot --syntax=TriX KORT10.1.xml
> >>>>>>>>>
> >>>>>>>>> and I got:
> >>>>>>>>>
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 15, col: 99] {E202}
> >>>>>>>>> Expecting XML start or end element(s). String data
> >>>>>>>>> "https://localhost:4443/atomgraph/city-graph/graphs/616337ee-f0f9-455f-a838-037fa875dbdd";
> >>>>>>>>>
> >>>>>>>>> not allowed. Maybe there should be an rdf:parseType='Literal' for
> >>>>>>>>> embedding mixed XML content in RDF. Maybe a striping error.
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 16, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 21, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 26, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 31, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 36, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 WARN riot :: [line: 39, col: 77] {W102}
> >>>>>>>>> unqualified use of rdf:datatype is deprecated.
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 41, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 46, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 51, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 56, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 61, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 ERROR riot :: [line: 66, col: 15] {E201}
> >>>>>>>>> Multiple children of property element
> >>>>>>>>> 13:25:02 WARN riot :: [line: 69, col: 77] {W102}
> >>>>>>>>> unqualified use of rdf:datatype is deprecated.
> >>>>>>>>>
> >>>>>>>>> which looks like riot is trying to parse the file as RDF/XML
> >>>>>>>>> instead.
> >>>>>>>>>
> >>>>>>>>> Is TriX not supported on command line?
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Martynas
> >>>>>>>>>
> >>>>>>>
> >>>>
> >>

Reply via email to