Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
A JavaScript API for selecting and manipulating subgraphs of linked data.
This is a work in progress! The API will definitely change.
modelld
is a library which helps you build apps on top linked data. It
provides a higher-level interface for graph manipulation than you'd get using
something like rdf-ext or
rdflib.js out of the box. It also
makes it easy to save graphs back to LDP services even if your models are made
up of data from several different URIs.
modelld
makes working with linked data easier by providing developers with an
API for defining their own schemas on top of graphs of data. It's sort of like
an ORM but for linked data.
modelld
is a work in progress. Don't depend on it for anything.
Here are the things that I'm either actively working on, or that should be worked on in the near future:
Here's how you might use modelld
to model part of a
Solid user profile:
import { modelFactory } from 'modelld'
import { vocab, rdflib, web } from 'solid-client'
const profileModel = modelFactory(rdflib, {
name: vocab.foaf('name'),
picture: vocab.foaf('img'),
phone: vocab.foaf('phone')
})
const defaultGraph = 'https://me.databox.me/profile/card'
const webId = 'https://me.databox.me/profile/card#me'
// Suppose you've got an RDF graph named 'graph'
const profile = profileModel(graph, defaultGraph, webId)
// Get the value of some fields
profile.any('phone') // => 'tel:000-000-0000'
profile.get('phone') // => ['tel:000-000-0000', 'tel:111-111-1111']
profile.fields('phone') // => [Field('tel:000-000-0000'), Field('tel:111-111-1111')]
// Undeclared fields don't show up
profile.any('undeclared-field') // => undefined
profile.get('undeclared-field') // => []
profile.fields('undeclared-field') // => []
// Add a field. Models are immutable, so adding/setting/removing fields always
// returns a new model.
const newProfile = profile.add('phone', 'tel:123-456-7890')
profile.get('phone') // => ['tel:000-000-0000', 'tel:111-111-1111']
newProfile.get('phone') // => ['tel:000-000-0000', 'tel:111-111-1111', 'tel:123-456-7890']
// Remove a field
const myName = profile.fields('name')[0]
profile
.remove(myName)
.any('name') // => undefined
// Update a field's value
const name = profile.fields('name')[0]
profile
.set(name, 'Daniel')
.any('name') // => 'Daniel'
// Update the namedGraph for a field
profile.setAny('name', {namedGraph: 'https://example.com/other-resource'})
// Save a model back to the LDP server(s) it came from
const name = profile.fields('name')[0]
profile
.set(name, 'Daniel')
.add('phone', 'tel:123-456-7890')
.save(rdflib, web)
.then(newModel => {
console.log(newModel.get('name'))
console.log(newModel.get('phone'))
})
.catch(err => {
// err.model is the model including all the updates which worked
// err.diffMap describes the RDF statements which should have been inserted and removed from the server
// err.failedURIs describes the URIs for which the PATCH requests failed
})
$ npm install --save modelld
FAQs
A JavaScript API for selecting and manipulating linked data subgraphs
We found that modelld demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.