All Projects → LDflex → LDflex-Comunica

LDflex / LDflex-Comunica

Licence: MIT license
Comunica query engine support for the LDflex language

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to LDflex-Comunica

Aresdb
A GPU-powered real-time analytics storage and query engine.
Stars: ✭ 2,814 (+18660%)
Mutual labels:  query
PageQueryBoss
A ProcessWire Module to build complex nested queries containing multipple fields and pages and return an array that can be parsed to JSON. This is usefull to fetch data for SPA and PWA.
Stars: ✭ 18 (+20%)
Mutual labels:  query
micro-query
Simple query string parser for Vercel's Micro
Stars: ✭ 23 (+53.33%)
Mutual labels:  query
strapi-graphql-documentation
Collections of queries and mutations that hopefully help you in a Strapi project powered by GraphQL API 🚀
Stars: ✭ 45 (+200%)
Mutual labels:  query
dora
JSON parser/explorer
Stars: ✭ 42 (+180%)
Mutual labels:  query
SQLiteHelper
🗄 This project comes in handy when you want to write a sql statement easily and smarter.
Stars: ✭ 57 (+280%)
Mutual labels:  query
Termsql
Convert text from a file or from stdin into SQL table and query it instantly. Uses sqlite as backend. The idea is to make SQL into a tool on the command line or in scripts.
Stars: ✭ 230 (+1433.33%)
Mutual labels:  query
querqy-elasticsearch
Querqy for Elasticsearch
Stars: ✭ 37 (+146.67%)
Mutual labels:  query
ts3admin.class
The ts3admin.class is a powerful api for communication with Teamspeak 3 Servers from your website! Your creativity knows no bounds!
Stars: ✭ 107 (+613.33%)
Mutual labels:  query
py-jsonq
A simple Python package to Query over Json Data
Stars: ✭ 100 (+566.67%)
Mutual labels:  query
kubectl-sql
kubectl-sql is a kubectl plugin that use SQL like language to query the Kubernetes cluster manager
Stars: ✭ 50 (+233.33%)
Mutual labels:  query
juice
Reduce in memory data structures using a lightweight query language
Stars: ✭ 24 (+60%)
Mutual labels:  query
powerorm
A very simple but effective php orm
Stars: ✭ 21 (+40%)
Mutual labels:  query
wikit
Wikit - A universal lookup tool
Stars: ✭ 149 (+893.33%)
Mutual labels:  query
rx-query
timdeschryver.github.io/rx-query/
Stars: ✭ 195 (+1200%)
Mutual labels:  query
Sqliterally
Lightweight SQL query builder
Stars: ✭ 231 (+1440%)
Mutual labels:  query
facilejdbc
FacileJDBC - Fast, simple and lightweight JDBC wrapper
Stars: ✭ 34 (+126.67%)
Mutual labels:  query
service-fabric-queryable
Enable query support for your stateful services in Service Fabric via the OData protocol.
Stars: ✭ 42 (+180%)
Mutual labels:  query
chartjs-plugin-datasource-prometheus
Chart.js plugin for Prometheus data loading
Stars: ✭ 77 (+413.33%)
Mutual labels:  query
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 (+700%)
Mutual labels:  query

Comunica for LDflex

This library lets you use the Comunica query engine with the LDflex language.

npm version build Coverage Status Dependency Status

Installation

npm install ldflex @ldflex/comunica

Usage

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",
  }
};
// The query engine and its source
const queryEngine = new ComunicaEngine('https://ruben.verborgh.org/profile/');
// The object that can create new paths
const paths = new PathFactory({ context, queryEngine });

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

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

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

Features

Using a customised ComunicaEngine

This example uses the comunica engine for local file queries.

const { PathFactory } = require('ldflex');
const { default: ComunicaEngine } = require('@ldflex/comunica');
const { namedNode } = require('@rdfjs/data-model');
const { newEngine: localFileEngine } = require('@comunica/actor-init-sparql-file');

// The JSON-LD context for resolving properties
const context = {
  "@context": {
    "@vocab": "http://xmlns.com/foaf/0.1/",
    "friends": "knows",
  }
};
// The query engine and its source
const queryEngine = new ComunicaEngine(
    path.join(__dirname, 'ruben-verborgh.ttl'),
    { engine: localFileEngine() }
  );
// The object that can create new paths
const paths = new PathFactory({ context, queryEngine });

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

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

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

Adding custom options to the ComunicaEngine

Add comunica context options which are passed to the Comunica Engine.

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",
  }
};

// The query engine and its source
const queryEngine = new ComunicaEngine(
    'https://ruben.verborgh.org/profile/',
    { options: {/* add options here */} },
  );

// The object that can create new paths
const paths = new PathFactory({ context, queryEngine });

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

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

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

Updating data

By default the source given is also used as the destination for updates (if multiple sources are given, then the first one is chosen).

Optionally you can specify your own destination for updates as follows

// The query engine and its source
const queryEngine = new ComunicaEngine(
    'https://ruben.verborgh.org/profile/',
    { destination: 'https://example.org/destination' },
  );

License

©2018–present Ruben Verborgh, Joachim Van Herwegen, Jesse Wright. 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].