Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Commit

Permalink
ref #45
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed May 9, 2019
1 parent a48ba98 commit 6f50267
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/lib/rdf/getGraph.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Debug from 'debug'
import rdf from 'rdf-ext'
import N3Parser from 'rdf-parser-n3'
import JsonLdParser from 'rdf-parser-jsonld'
import convert from 'buffer-to-stream'

import { Path, BlobTree, urlToPath } from '../storage/BlobTree'
Expand All @@ -14,9 +15,20 @@ export function getEmptyGraph () {
}

function readRdf (rdfType: RdfType | undefined, bodyStream: ReadableStream) {
let parser = new N3Parser({
factory: rdf
})
let parser
switch (rdfType) {
case RdfType.JsonLd:
parser = new N3Parser({
factory: rdf
})
break
case RdfType.Turtle:
default:
parser = new N3Parser({
factory: rdf
})
break
}
return parser.import(bodyStream)
}

Expand Down

0 comments on commit 6f50267

Please sign in to comment.