0.4.1 • Published 4 years ago

@tpluscode/fun-ddr-sparql-graph-repository v0.4.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

SPARQL Graph Store for fun-ddr

Installation

npm i --save @tpluscode/fun-ddr-sparql-graph-repository hydra-box

Usage

  1. Create a repository
import rdfFetch from 'hydra-box/lib/rdfFetch'
import { SparqlGraphRepository } from '@tpluscode/fun-ddr-sparql-graph-repository'
import { expand } from '@zazuko/rdf-vocabularies'

const sparqlClient = new SparqlHttp({
  endpointUrl,
  updateUrl,
  fetch: rdfFetch,
})

// The namespace URI for resources
const base = 'http://my.resource.ns/'

// JSON-LD context document for (de)serializing
const context = {
  '@vocab': 'https://my.vocabulary.ns/',
  name: expand('schema:name'),
}

// A frame used to deserialize triples
const frame  = {
  '@type': 'Person',
}

export const people = new SparqlGraphRepository<T>(sparqlClient, base, context, frame)
  1. Use it to retrieve and save aggregates
import { people } from './repository/people'

const person = await people.load('...')

person.mutate(changeLastName)({ newName: 'Doe', reason: 'marriage' })
  .commit(people)
  .catch(console.error)
0.4.1

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago