1

I have a .nq file and I want to load it into a Fuseki triple store, but I get the following error:

Exception in thread "main" org.apache.jena.atlas.AtlasException: java.nio.charset.MalformedInputException: Input length = 1
at org.apache.jena.atlas.io.IO.exception(IO.java:206)
at org.apache.jena.atlas.io.CharStreamBuffered$SourceReader.fill(CharStr
eamBuffered.java:77)
at org.apache.jena.atlas.io.CharStreamBuffered.fillArray(CharStreamBuffe
red.java:154)
at org.apache.jena.atlas.io.CharStreamBuffered.advance(CharStreamBuffere
d.java:137)
at org.apache.jena.atlas.io.PeekReader.advanceAndSet(PeekReader.java:243
)
   at org.apache.jena.atlas.io.PeekReader.init(PeekReader.java:237)
   at org.apache.jena.atlas.io.PeekReader.peekChar(PeekReader.java:159)
   at org.apache.jena.atlas.io.PeekReader.makeUTF8(PeekReader.java:100)
   at org.apache.jena.riot.tokens.TokenizerFactory.makeTokenizerUTF8(Tokeni
zerFactory.java:41)
   at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:131)
   at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTFactoryImpl$1.read(R
DFParserRegistry.java:141)
   at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:859)
   at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
   at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:666)
   at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:654)
   at com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.loadQuads$(BulkLoader
.java:149)....

Is it possible to load a .nq file into the fuseki? I use the following command:

tdbloader --loc=data articles.nq

My Jena version is apache-jena-2.11.2, and fuseki version is jena-fuseki-1.0.2.

Thanks in advance!

Enayat
  • 3,904
  • 1
  • 33
  • 47
  • 2
    Could you provide the data? The issue isn't N-Quads support, but your data seems to be broken -- very possibly an encoding issue, could you check this is utf-8? (Also you're using TDB directly, not fuseki, so the title is a little misleading) – user205512 Jun 25 '14 at 14:00
  • Thanks for your correction. Actually, I am trying to import a nq file at http://opencitations.net/data/complete/articles.nq.gz – Enayat Jun 25 '14 at 14:15
  • That link doesn't appear to exist. There are a number of files in that directory, but none seem to be n-quads. – user205512 Jun 25 '14 at 14:28
  • 2
    From the [README](http://opencitations.net/data/complete/README): "articles.nq.gz currently being regenerated due to syntax errors found in the previous version." :-) – user205512 Jun 25 '14 at 14:35
  • This is the actual link, I was wrong: http://opencitations.net/data/sample/articles.nq.gz – Enayat Jun 25 '14 at 15:50

1 Answers1

4

You can load N-Quads.

The problem is that the data is not UTF-8.

articles.nq.gz appears to be gzip file of gzip of the data. Two level of gzip.

One run of gzip leaves a binary file, not N-quads.

The real data is pretty messy but its warnings (as far as I got).

AndyS
  • 16,345
  • 17
  • 21
  • So how can I access to actual nq file except decompressing it? – Enayat Jun 26 '14 at 10:25
  • @EnayatR. Why wouldn't you decompress it? But see [How do I get the InputStream of decompressed data from an InputStream of GZIPed data?](http://stackoverflow.com/q/1744290/1281433) – Joshua Taylor Jun 26 '14 at 11:54