7.11.109 • Published 11 months ago

@diotoborg/omnis-explicabo v7.11.109

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@diotoborg/omnis-explicabo

build status npm version

Map for RDF/JS Sink including shortcut methods.

Usage

The package provides Map from a string key to a Sink with a shortcut for .import. Typical it's used to store parsers or serializers for specific media types. As SinkMap extends from the ECMAScript 2015 Map and doesn't overload any standard methods, methods like set, get, has or delete can be used as defined in the specification.

Create a SinkMap

The constructor accepts arrays with key/sink pairs to fill the map:

const map = new SinkMap([
  ['text/turtle', new ParserN3()]
])

It's also possible to create an empty map and add or extend it later using the .set() method:

const map = new SinkMap()

map.set('text/turtle') = new ParserN3()

Find a Sink

The .get method searches for the matching Sink and returns it:

const map = new SinkMap([...])

const sink = map.get('text/turtle')

if (sink) {
  // found
} else {
  // not found
}

Import shortcut

Usually you want to call the .import method of the matching Sink. The map provides a shortcut for this. It also has a .import method, but requires additionally the key as the first argument. It returns null if no matching sink was found:

const map = new SinkMap([...])

const input = fs.createReadStream('..')
const output = map.import('text/turtle', input)

if (output) {
  // found
} else {
  // not found
}

Example

Here is a complete example where the map is used to store parsers and the .import shortcut is used to parse a string input:

import SinkMap from '@diotoborg/omnis-explicabo'
import ParserN3 from '@rdfjs/parser-n3'
import { Readable } from 'readable-stream'

const map = new SinkMap([
  ['text/turtle', new ParserN3()]
])

const input = new Readable({
  read: () => {
    input.push(`
      PREFIX s: <http://schema.org/>

      [] a s:Person ;
        s:jobTitle "Professor" ;
        s:name "Jane Doe" ;
        s:telephone "(425) 123-4567" ;
        s:url <http://www.janedoe.com> .
    `)
    input.push(null)
  }
})

const output = map.import('text/turtle', input)

output.on('data', quad => {
  console.log(`${quad.subject.value} - ${quad.predicate.value} - ${quad.object.value}`)
})
packagedataviewjsxrdstyped arrayargsconsolepipejsonstyleguidereact-hookssetPrototypeOfredirectes5waapiserviceexecfileprivateback-endparsezxdeterministicec2json-schema-validatorvarclassnamesBigInt64ArraycloudfrontlockfileramdafindLastpathcopyURLinspectPushfindLastIndexlastHyBifast-copycomputed-typesArrayBufferstableSymbolRegExp#flagssameValueZerobddconfigminimaljoidebugwgetObject.valuesgetjson-schema-validationwafbannerpushsliceasyncPromisegesturestypedarraysStyleSheetttyvaluesinstallclassesexecbuffersframeworkspinnerfastclonelanguageutilwalkingshimidleTypedArraysharedbinyamlES2023recursiveURLSearchParamselasticachees2015command-linerouterslotdependenciesreact-testing-libraryStreamsproxyECMAScript 2015astuuidcorejsdifffnmatchrulessettingsgetterstreamsschemepinoboundsortedes-shimsxtermignorethreechromequoteimmutableinstrumentationchildArray.prototype.flattenendpointkinesisgrouparraystypeString.prototype.trimmake direntriesinputsuperstructrmhigher-orderdeepclonefpsmatchesreact animationtc39constintrinsicsyntaxgdprdataWeakSetES5traversetranspileeslintgroupBycurriedamazonchinesechaiES2015flagsfastviewlengthrangeerrorsortfull-widthpackagesstylesharmonyexpressionsubprocessobjectequalitymkdirpspinnerszodread-0domphoneassertioncreatepicomatchtoolkitpurewritable$.extendcircularespreeremovemkdiresnodejschromiumrsspreprocessorbyteLengthmergearraybufferserializerflattypedarraycharactersjasminevpcjapaneseawesomesauceprotonamesArray.prototype.containsArray.prototype.flatlibphonenumberreduxdescriptormatchreal-timees6utilityECMAScript 2016redactformsglobmoveWeakMapArrayBuffer#slicebyteOffsetformatwaitawsqueryagentmatchAllhelpersstringifieriamnpmrestfulutilitiesUnderscorebrowsercss-in-jsStreamMapemrJSON3dconcatglobalECMAScript 2022loggingcontainskoreansyntaxerrorinstallervalidatorassignbinariesbundler.gitignoretapECMAScript 2017stringsymboltsjshintroutingvisualESnextcollection.es6.envformstringifydayjs6to5varsprocessincludesmulti-packagemakeArray.prototype.flatMapexpresshttpWebSocketpopmotionmkdirssesES2022stylingpostcss-plugincode pointsreuseTypeScriptenvflatMapcurlfulljestfind-upES2016rm -froutputrmdirxhrvalidprunereversedwalkoptionzeroES6sqsserializeanimationObservablesperformanceistanbulobjasterisksexecutetypesafevariablesoptimistmockletregular-expressiontslibeventsArray.prototype.findLastIndexargvtestcore-jsprettycloudtrailfpArrayregular expressionsprogressFloat64ArrayreducertranspilerhasOwnPropertycacheguidtrimRightspringbindl10nislistenersfunctionsdiffs3regexAsyncIteratorequalArray.prototype.includes
7.11.109

11 months ago

7.11.108

11 months ago

7.11.107

11 months ago

7.11.106

11 months ago

7.10.106

11 months ago

7.10.105

11 months ago

7.10.104

11 months ago

6.10.104

11 months ago

6.9.104

11 months ago

6.9.103

11 months ago

6.9.102

11 months ago

6.9.101

11 months ago

6.9.100

11 months ago

6.9.99

11 months ago

6.9.98

11 months ago

6.9.97

11 months ago

6.8.97

11 months ago

6.8.96

11 months ago

6.8.95

11 months ago

6.8.94

11 months ago

6.8.93

11 months ago

5.8.93

11 months ago

5.8.92

12 months ago

5.8.91

12 months ago

5.8.90

12 months ago

5.8.89

12 months ago

5.8.88

12 months ago

5.8.87

12 months ago

5.8.86

12 months ago

5.8.85

12 months ago

5.8.84

12 months ago

5.8.83

12 months ago

5.8.82

12 months ago

5.8.81

12 months ago

5.7.81

12 months ago

5.7.80

12 months ago

5.7.79

12 months ago

4.7.79

12 months ago

4.7.78

12 months ago

4.6.78

12 months ago

4.6.77

12 months ago

4.6.76

12 months ago

4.6.75

1 year ago

4.6.74

1 year ago

4.6.73

1 year ago

4.6.72

1 year ago

4.6.71

1 year ago

4.6.70

1 year ago

4.6.69

1 year ago

4.6.68

1 year ago

4.6.67

1 year ago

4.5.67

1 year ago

4.5.66

1 year ago

4.5.65

1 year ago

4.5.64

1 year ago

4.5.63

1 year ago

4.5.62

1 year ago

4.5.61

1 year ago

4.5.60

1 year ago

4.5.59

1 year ago

4.5.58

1 year ago

4.5.57

1 year ago

3.5.57

1 year ago

3.5.56

1 year ago

3.5.55

1 year ago

3.5.54

1 year ago

3.5.53

1 year ago

3.5.52

1 year ago

3.5.51

1 year ago

3.5.50

1 year ago

3.5.49

1 year ago

3.5.48

1 year ago

3.4.48

1 year ago

3.4.47

1 year ago

3.4.46

1 year ago

3.4.45

1 year ago

3.4.44

1 year ago

3.4.43

1 year ago

3.3.43

1 year ago

3.3.42

1 year ago

3.3.41

1 year ago

3.3.40

1 year ago

3.3.39

1 year ago

3.3.38

1 year ago

3.3.37

1 year ago

3.3.36

1 year ago

3.2.36

1 year ago

3.2.35

1 year ago

3.2.34

1 year ago

3.2.33

1 year ago

3.2.32

1 year ago

3.2.31

1 year ago

3.2.30

1 year ago

3.2.29

1 year ago

3.2.28

1 year ago

3.2.27

1 year ago

3.2.26

1 year ago

3.2.25

1 year ago

3.2.24

1 year ago

3.2.23

1 year ago

3.2.22

1 year ago

3.2.21

1 year ago

2.2.21

1 year ago

1.2.21

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.2.17

1 year ago

1.2.16

1 year ago

1.2.15

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago