karelklima / ldkit Goto Github PK
View Code? Open in Web Editor NEWLDkit - Linked Data query toolkit for TypeScript developers
Home Page: https://ldkit.io
License: MIT License
LDkit - Linked Data query toolkit for TypeScript developers
Home Page: https://ldkit.io
License: MIT License
Consider supporting language filtering on SPARQL level.
For example, for schema:
const Person = {
"@type": schema.Person,
name: {
"@id": schema.name,
"@language": "cs"
}
};
When querying, the SPARQL query would filter only values with cs
language for the schema:name
property.
TODO:
esm.sh
imports with npm:
importsIt should be possible to pass a graph
IRI to a resource context, effectively restricting all SPARQL queries to the particular graph.
This is useful for focusing resources / queries over a particular graph / context in a database.
For additional developer experience, LDkit should allow for the following:
lens.match({ name: "Abc"});
lens.update({ $id, prop: { $add: "value"; })
;This may require to extend LDkit language significantly. An alternative approach would be to use a proxy and translate actions on objects to SPARQL UPDATE queries, e.g. res.property.push("value")
and then res.update(property)
would yield the same result.
Consider using MongoDB language as an inspiration.
LDkit could support collections for greater benefits of developers.
Prerequisites:
The referenced bindings factory comes with Immutable.js package, which is huge. Consider replacing it with custom implementation.
Include:
It should be possible to configure custom logger, and perhaps override the default one, using some reasonable interface. It should be compatible with the most prominent logging solutions in both Deno and Node.
Update to newest version of libraries, switch to Deno if possible.
The interface should enable user to do more powerful queries, order results, and find specific resources more easily.
Prisma could be a good inspiration in what to accomplish:
const results = await prisma.post.findMany({
skip: 200,
take: 20,
where: {
email: {
contains: 'Prisma',
},
},
orderBy: {
title: 'desc',
},
})
Some SPARQL servers like Oxigraph which I am using do not support application/rdf+json
in CONSTRUCT/DESCRIBE queries. I currently convert text/turtle
to json manually in a custom fetch function.
What would be the best way ti support this?
Namespaces are referenced through namespaces/mod.js
internally, which may be an issue for tree shaking (confirmed - ParcelJS). Namespaces should be referenced directly within the library.
Currently the schema requires the user to have a type, which is fine for main entities, but may be a problem for sub schemas or generally substructures in schema. Therefore it should be possible to define a schema and the data shape without the type.
For a schema to be valid, at least a type or one property must be defined.
Right now it is not straightforward to update arrays, users either need to provide the whole array as a replacement, or directly insert or delete quads. It is also not clear how this behavior works for subschemas.
The goal is to support array modification using $set
, $add
and $remove
operators.
The array operations will only consider literals or IRIs, not complex objects, i.e. it should be possible to create connections between a schema and subschema entity, but the operation should not result in updating an entity in an array. That would be confusing and unwanted.
Example:
Persons.update({
$id: "http://some/person",
friends: {
$add: ["http://second/person"],
$remove: ["http://third/person"]
}
})
Related work: #48
Improve LDkit performance by allowing some properties to be lazy loaded, so that the user has to await them before being used.
Considerations:
It should be possible to specify that a property in schema is @inversed
, reversing the triple pattern matching (s p o -> o p s). Useful for querying data with incoming links.
Options:
Alternative options:
LDkit currently loads all RDF types of main entities in schemas, which has a performance impact, especially on the query engine / SPARQL endpoint.
TODO:
Use case: authorization, custom headers.
Currently, it is possible to set a language within the Context
, which has its negatives. As an alternative, consider instead adding support to filter certain fields by language using the find
method and the where
specification.
Currently the typings of results coming from lens are resolved as SchemaInterface<{ property: ... }>
and developers can see this wrapped schema instead of the actual objects and properties. Provide a better type resolution to "unwrap" the types.
Improve DX of schema specification using const
type parameters: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#const-type-parameters
This could be useful for creating a schema so that the as const
is not needed, and may perhaps be replaced with a wrapper function.
TODO:
At the moment it is possible to specify limit of entities to query and pagination must be done in client side. Users should be able to specify offset and limit when querying for entities.
The AsyncIterator dependency is based on Node EventEmitter, which cannot be used in browser without polyfill. Since the dependency is not heavily used, it should be removed in favor of regular async iteration.
Include SPARQL endpoint requirements and a list of supported software (e.g. Virtuoso, GraphDB).
Multilanguage arrays may be confusing and not really a relevant feature, consider dropping support. Not sure what is the use case for that anyway, besides perhaps cleaning up messy data.
The SPARQL builder dependency comes with a lot of data, including a separate DataFactory and vocabularies. Consider implementing a custom solution.
Creating context and passing it to a resource
While it is possible to replace QueryBuilder component in LDkit during runtime, it is not straightforward and the API for this is not documented. Users should be able to define a custom QueryBuilder so that they can modify SPARQL queries or perhaps implement custom query languages more easily if needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.