ezs-lodex
ezs dedicated statements for Lodex
Last updated 2 years ago by parmentf .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ezs-lodex 
SYNC missed versions from official npm registry.

A collection of ezs functions for Lodex.

This package cannot be used alone. ezs has to be installed

Usage

import ezs from 'ezs';
import lodex from 'ezs-lodex';

ezs.use(lodex);

process.stdin
    .pipe(ezs('flattenPatch'))
    .pipe(process.stdout);

Statements

Table of Contents

convertJsonLdToNQuads

Take a JSON-LD object and transform it into NQuads triples.

Returns String

convertToAtom

Generate an atom XML feed from a resources feed, the LODEX configuration and model.

Parameters

  • fields Object LODEX model (optional, default {})
  • atomFeed Feed A feed of resources, see feed (optional, default {})
  • config Object LODEX configuration (with perPage) (optional, default {})

Returns String

convertToExtendedJsonLd

Convert the result of an ISTEX query to an extended JSON-LD.

Every hit must contain the URI of original lodex resource, linked to the query.

Parameters

  • schemeForIstexQuery string URI to put between document and resource

Field

Type: Object<string, any>

Properties

  • name string The identifier of the field.
  • scheme string The semantic property of the field.

extractIstexQuery

Extract an ISTEX API query.

Parameters

  • fields Array<Field> list of LODEX fields (optional, default [])

Examples

Output:

{
   content: 'fake query',
   lodex: {
      uri: 'http://resource.uri',
  },
}

getParam

flattenPatch

Take Object and transform all key ending byu number on array.

Returns Object

getLastCharacteristic

Get last characteristic (list of all dataset covering fields).

Examples

Input:

[
  {
    "_id" : ObjectId("5ca32c64019f45001d2b602d"),
    "publicationDate" : ISODate("2019-04-02T09:33:24.463Z")
  },
  {
    "_id" : ObjectId("5cee50bb019f45001d2b602f"),
    "publicationDate" : ISODate("2019-05-29T09:28:27.773Z")
  },
  {
    "_id" : ObjectId("5cee5119019f45001d2b6031"),
    "publicationDate" : ISODate("2019-05-29T09:30:01.319Z")
  },
  {
    "_id" : ObjectId("5cee5153019f45001d2b6032"),
    "publicationDate" : ISODate("2019-05-29T09:30:59.770Z")
  },
  {
    "_id" : ObjectId("5cee5160019f45001d2b6033"),
    "publicationDate" : ISODate("2019-05-29T09:31:12.503Z")
  },
  {
    "_id" : ObjectId("5cee530e3e9676001909ba24"),
    "publicationDate" : ISODate("2019-05-29T09:38:22.569Z")
  }
]

Output:

{
  "_id" : ObjectId("5cee530e3e9676001909ba24"),
  "publicationDate" : ISODate("2019-05-29T09:38:22.569Z")
}

Returns any

keyMapping

Take an object and map its keys to the one in mapping parameters. Keep keys absent in from parameter.

Parameters

Examples

Input:

[{
  "dFgH": "Value",
  "AaAa": "Value 2"
}]

EZS:

[keyMapping]
from = dFgH
to = Title
from = AaAa
to = Description

Output

[{
  "Title": "Value",
  "Description": "Value 2"
}]

Returns any Same object with modified keys

objects2columns

Take Object and ...

Returns Object

parseNQuads

Take N-Quads string and transform it to Objects.

Returns Object

writeTurtle

Take quad or prefixes object and return turtle string.

Examples

Input:

[{
   quad: {
     subject: { id: 'http://uri/janedoe' },
     predicate: { id: 'http://schema.org/jobTitle' },
     object: { id: '"Professor"' }
   }
 }, {
     quad: {
     subject: { id: 'http://uri/janedoe' },
     predicate: { id: 'http://schema.org/name' },
     object: { id: '"Jane Doe"' }
   }
 }, {
     quad: {
     subject: { id: 'http://uri/janedoe' },
     predicate: { id: 'http://schema.org/telephone' },
     object: { id: '"(425) 123-4567"' }
     }
 }, {
     quad: {
     subject: { id: 'http://uri/janedoe' },
     predicate: { id: 'http://schema.org/url' },
     object: { id: 'http://www.janedoe.com' }
     }
 }, {
     quad: {
     subject: { id: 'http://uri/janedoe' },
     predicate: { id: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' },
     object: { id: 'http://schema.org/Person' }
     }
 }, { prefixes: {} }
 ]

Output:

'@prefix schema: <http://schema.org/>.\n'
'@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n'
'\n'
'<http://uri/janedoe> schema:jobTitle "Professor";\n'
'    schema:name "Jane Doe";\n'
'    schema:telephone "(425) 123-4567";\n'
'    schema:url <http://www.janedoe.com>;\n'
'    a schema:Person.\n"'

Returns String turtle

Current Tags

  • 7.0.2                                ...           latest (a year ago)

27 Versions

  • 7.0.2                                ...           a year ago
  • 7.0.1                                ...           a year ago
  • 7.0.0                                ...           a year ago
  • 6.0.0                                ...           a year ago
  • 5.4.1                                ...           a year ago
  • 5.4.0                                ...           a year ago
  • 5.3.0                                ...           a year ago
  • 5.2.2                                ...           a year ago
  • 5.2.1                                ...           a year ago
  • 5.2.0                                ...           a year ago
  • 5.1.0                                ...           a year ago
  • 5.0.0                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 3.0.0                                ...           2 years ago
  • 2.0.9                                ...           2 years ago
  • 2.0.8                                ...           2 years ago
  • 2.0.7                                ...           2 years ago
  • 2.0.6                                ...           2 years ago
  • 2.0.4                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |