Skip to content

Commit

Permalink
refactor: do not rely on rdf-ext interface
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Aug 24, 2023
1 parent a207bad commit abf6b48
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
10 changes: 1 addition & 9 deletions packages/formats/csvw.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import sinkToDuplex from '@rdfjs/sink-to-duplex'
import rdf from '@zazuko/env'
import CsvwParser from 'rdf-parser-csvw'
import tracer from './lib/tracer.js'

function toDataset(streamOrDataset) {
if (!streamOrDataset.readable) {
return Promise.resolve(streamOrDataset)
}

return rdf.dataset().import(streamOrDataset)
}
import { toDataset } from './lib/stream.js'

function parse(args) {
let metadata
Expand Down
10 changes: 10 additions & 0 deletions packages/formats/lib/stream.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import fromStream from 'rdf-dataset-ext/fromStream.js'
import rdf from '@zazuko/env'

export function toDataset(streamOrDataset) {
if (!streamOrDataset.readable) {
return Promise.resolve(streamOrDataset)
}

return fromStream(rdf.dataset(), streamOrDataset)
}
4 changes: 2 additions & 2 deletions packages/formats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"@rdfjs/sink-to-duplex": "^1.0.0",
"@zazuko/env": "^1.1.0",
"barnard59-base": "^1.0.0",
"rdf-dataset-ext": "^1.0.1",
"rdf-parser-csvw": "^0.15.0",
"rdf-parser-csvw-xlsx": "^0.1.0",
"rdfxml-streaming-parser": "^1.2.0"
},
"devDependencies": {
"chai": "^4.3.7",
"rdf-dataset-ext": "^1.0.1"
"chai": "^4.3.7"
},
"engines": {
"node": ">= 14.0.0"
Expand Down
10 changes: 1 addition & 9 deletions packages/formats/xlsx.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import sinkToDuplex from '@rdfjs/sink-to-duplex'
import rdf from '@zazuko/env'
import CsvwXlsxParser from 'rdf-parser-csvw-xlsx'
import tracer from './lib/tracer.js'

function toDataset(streamOrDataset) {
if (!streamOrDataset.readable) {
return Promise.resolve(streamOrDataset)
}

return rdf.dataset().import(streamOrDataset)
}
import { toDataset } from './lib/stream.js'

function parse(args) {
let metadata
Expand Down

0 comments on commit abf6b48

Please sign in to comment.