question

Upvotes
Accepted
1 1 1 2

processing organization bulk download using node js

Hi guys, i would like to process this file (OpenPermID-bulk-organization-20191124_084723) using node js.

i have just created a node js command to download and uncompress gz files.

But, i can't be able to process that file.

I tried using N3 with/without streams...


permid-apiintelligent-tagging-apiopen-permid-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @gelordi,

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

-AHS

Hello @gelordi,

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

-AHS

1 Answer

· Write an Answer
Upvotes
Accepted
78.8k 250 52 74

@gelordi

I have used the TTL file with this code.

const N3 = require('n3');
const fs = require('fs')
const parser = new N3.Parser(),
rdfStream = fs.createReadStream('OpenPermID-bulk-organization-20191201_084716.ttl');
parser.parse(rdfStream, console.log);

It showed this error:

null Quad {
  subject: NamedNode { id: 'https://permid.org/1-5000487228' },
  predicate:
   NamedNode { id: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' },
  object:
   NamedNode { id: 'http://permid.org/ontology/organization/Organization' },
  graph: DefaultGraph { id: '' } }
{ Error: Undefined prefix "xsd:" on line 10.
    at N3Parser._error (C:\node_modules\n3\lib\N3Parser.js:845:15)
    at N3Parser._readEntity (C:\node_modules\n3\lib\N3Parser.js:188:47)
    at N3Parser._completeLiteral (C:\node_modules\n3\lib\N3Parser.js:517:29)
    at N3Parser._readDataTypeOrLang (C:\node_modules\n3\lib\N3Parser.js:503:17)
    at C:\node_modules\n3\lib\N3Parser.js:995:127
    at N3Lexer._tokenizeToEnd (C:\node_modules\n3\lib\N3Lexer.js:382:7)
    at ReadStream.<anonymous> (C:\node_modules\n3\lib\N3Lexer.js:524:22)
    at ReadStream.emit (events.js:189:13)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:261:13)
  context:
   { token: { line: 10, type: 'type', value: 'string', prefix: 'xsd' },
     line: 10,
     previousToken: { line: 10, type: 'literal', value: 'Canada\n', prefix: '' } } }

The problem can be solved by adding "@prefix xsd: <http://www.w3.org/2001/XMLSchema#>; ." at the beginning of the TTL file.

Please confirm the problem. Then I can contact the Open PermID support team to verify it.


1575261240067.png (422.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.