All Projects → LDflex → Ldflex

LDflex / Ldflex

Licence: mit
A JavaScript DSL for querying Linked Data on the Web

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Ldflex

Hypergraphql
GraphQL interface for querying and serving linked data on the Web.
Stars: ✭ 112 (-8.94%)
Mutual labels:  linked-data, query-language
m-custom-functions
This library contains created mostly pure M-functions without any other languages.
Stars: ✭ 24 (-80.49%)
Mutual labels:  query, query-language
miniql
A tiny JSON-based query language inspired by GraphQL
Stars: ✭ 121 (-1.63%)
Mutual labels:  query, query-language
kql
Kirby's Query Language API combines the flexibility of Kirby's data structures, the power of GraphQL and the simplicity of REST.
Stars: ✭ 120 (-2.44%)
Mutual labels:  query, query-language
Graphql Ld.js
Linked Data Querying with GraphQL
Stars: ✭ 65 (-47.15%)
Mutual labels:  linked-data, query
viziquer
Tool for Search in Structured Semantic Data
Stars: ✭ 12 (-90.24%)
Mutual labels:  linked-data, query-language
twinql
A graph query language for the semantic web
Stars: ✭ 17 (-86.18%)
Mutual labels:  linked-data, query-language
vaultaire
Query DSL and data access utilities for Corda developers.
Stars: ✭ 14 (-88.62%)
Mutual labels:  query, query-language
Semanticmediawiki
🔗 Semantic MediaWiki turns MediaWiki into a knowledge management platform with query and export capabilities
Stars: ✭ 359 (+191.87%)
Mutual labels:  linked-data, query
typeql
TypeQL: the query language of TypeDB - a strongly-typed database
Stars: ✭ 157 (+27.64%)
Mutual labels:  query, query-language
Rapidql
Query multiple APIs and DBs and join them in a single query
Stars: ✭ 91 (-26.02%)
Mutual labels:  query, query-language
Purescript Selda
A type-safe, high-level SQL library for PureScript
Stars: ✭ 72 (-41.46%)
Mutual labels:  query, query-language
Hypergraphql
GraphQL interface for querying and serving linked data on the Web.
Stars: ✭ 120 (-2.44%)
Mutual labels:  linked-data, query-language
Pgtyped
pgTyped - Typesafe SQL in TypeScript
Stars: ✭ 1,734 (+1309.76%)
Mutual labels:  query
Pgql Lang
PGQL is an SQL-based query language for the Property Graph data model
Stars: ✭ 114 (-7.32%)
Mutual labels:  query-language
Ts3admin.class
The ts3admin.class is a powerful api for communication with Teamspeak 3 Servers from your website! Your creativity knows no bounds!
Stars: ✭ 103 (-16.26%)
Mutual labels:  query
Vue Screen
Reactive screen size and media query states for VueJS
Stars: ✭ 120 (-2.44%)
Mutual labels:  query
Geotic
Entity Component System library for javascript
Stars: ✭ 97 (-21.14%)
Mutual labels:  query
Elasticsearch
Use SQL statements to query elasticsearch
Stars: ✭ 98 (-20.33%)
Mutual labels:  query
Open Semantic Entity Search Api
Open Source REST API for named entity extraction, named entity linking, named entity disambiguation, recommendation & reconciliation of entities like persons, organizations and places for (semi)automatic semantic tagging & analysis of documents by linked data knowledge graph like SKOS thesaurus, RDF ontology, database(s) or list(s) of names
Stars: ✭ 98 (-20.33%)
Mutual labels:  linked-data

LDflex makes Linked Data in JavaScript fun

LDflex is a domain-specific language for querying Linked Data on the Web as if you were browsing a local JavaScript graph.

npm version Build Status Coverage Status Dependency Status DOI

You can write things like person.friends.firstName to get a list of your friends. Thanks to the power of JSON-LD contexts and JavaScript's Proxy, these properties are not hard-coded in LDflex, but can be chosen at runtime. They feel as if you're traversing a local object, while you're actually querying the Web—without pulling in all data first.

Tim Berners-Lee came up with the idea for such a fluid JavaScript interface to Linked Data, in a discussion on how to make Linked Data easier for developers.

Articles and tutorials

Installation

npm install ldflex

In order to execute queries, you will also need a query engine:

npm install @ldflex/comunica

Usage

When you have obtained a starting subject, you can navigate through its properties using standard JavaScript dot property syntax.

In order to query for the result, use await if you want a single value, or for await to iterate over all values.

Initialization

const { PathFactory } = require('ldflex');
const { default: ComunicaEngine } = require('@ldflex/comunica');
const { namedNode } = require('@rdfjs/data-model');

// The JSON-LD context for resolving properties
const context = {
  "@context": {
    "@vocab": "http://xmlns.com/foaf/0.1/",
    "friends": "knows",
    "label": "http://www.w3.org/2000/01/rdf-schema#label",
  }
};
// The query engine and its source
const queryEngine = new ComunicaEngine('https://ruben.verborgh.org/profile/');
// The object that can create new paths
const path = new PathFactory({ context, queryEngine });

Looking up data on the Web

const ruben = path.create({ subject: namedNode('https://ruben.verborgh.org/profile/#me') });
showPerson(ruben);

async function showPerson(person) {
  console.log(`This person is ${await person.name}`);

  console.log(`${await person.givenName} is interested in:`);
  for await (const name of person.interest.label)
    console.log(`- ${name}`);

  console.log(`${await person.givenName} is friends with:`);
  for await (const name of person.friends.givenName)
    console.log(`- ${name}`);
}

Inspecting the generated path expression

(async person => {
  console.log(await person.friends.givenName.pathExpression);
})(ruben);

Getting all subjects of a document

(async document => {
  for await (const subject of document.subjects)
    console.log(`${subject}`);
})(ruben);

Getting all properties of a subject

(async subject => {
  for await (const property of subject.properties)
    console.log(`${property}`);
})(ruben);

Converting an LDflex expression into a SPARQL query

(async person => {
  console.log(await person.friends.givenName.sparql);
})(ruben);

Sorting path results

(async person => {
  for await (const uri of person.interest.sort('label'))
    console.log(`- ${uri}`);
})(ruben);

The sort function takes multiple arguments, creating a path that sorts on the last argument. The path can also continue after the sort: person.friends.sort('country', 'label').givenName will sort the friends based on the label of their country, and then return their names.

Additional Handlers

The following libraries provide handlers that extend the functionality of LDflex:

  • async-iteration-handlers Provides methods such as .map, .filter and .reduce for the async-iterable results returned by LDflex.

License

©2018–present Ruben Verborgh, Ruben Taelman. MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].