Code Monkey home page Code Monkey logo

quadstore-comunica's Introduction

Comunica for quadstore

This monorepo hosts a number of packages that comprise the build system of quadstore-comunica, a SPARQL query engine powered by Comunica and optimized for use with quadstore, both browser-side and server-side.

Directory structure

dir description
./engine the actual quadstore-comunica package and query engine
./spec SPARQL testing suite package
./packages dependencies and replacements bundled within quadstore-comunica
./examples runnable usage examples

Each package comes with its own README.md for further information.

Build process

quadstore-comunica is optimized for bundle size and dependency count.

The engine is based on @comunica/query-sparql-rdfjs-lite, bundled into a single file using Webpack 5.x and published in its bundled form to NPM. The bundle is intentionally kept un-minified to facilitate debugging and preservation.

Dependencies shared with quadstore appear as peerDependencies in engine/package.json.

sh scripts/install.sh   # run "npm install" across all packages
sh scripts/build.sh     # run "npm run build" across all packages in the correct order

cd ./spec
npm run spec:query      # run SPARQL 1.1 / Query test suite
npm run spec:update     # run SPARQL 1.1 / Update test suite

Nested bundles

The build process of this package replaces the variable prefix __webpack_ with __quadstore_comunica_ everywhere throughout the resulting bundle. This ensures that the latter can be included in other application bundles without triggering naming collisions of Webpack's internal variables.

More issues related to naming collisions between nested bundles:

webpack/webpack#1054 webpack/webpack#11277

See also this PR to vercel/ncc.

quadstore-comunica's People

Contributors

jacoscaz avatar

Stargazers

Webster Mudge avatar Jannis R avatar andrei avatar Dan Yamamoto avatar Ilkka Järstä avatar David Braun avatar Dmitry Sabanin avatar Kevin Nolan avatar

Watchers

Andreas Kuckartz avatar James Cloos avatar  avatar Matteo Murgida avatar Rù avatar

Forkers

allforabit

quadstore-comunica's Issues

Crypto polyfill always uses `import`

https://github.com/belayeng/quadstore-comunica/blob/20177a38f1790a33828684702f3655f1fdb2a8ea/engine/src/crypto-polyfill.js#L23

This check doesn't work because the Function constructor uses global scope for executing its parameter, but require is available in module scope.

In a debugger:

→ Function('return typeof require === \'function\'')()
false
→ typeof require === 'function'
true
→ global.require
undefined

This causes a problem with Jest, which injects its own module loaders, and import fails.

Is it possible to fool webpack using a variable? That's what I do for browserify, e.g.:

  if (typeof require === 'function') { // Probably safe, no?

    const cryptoModule = 'crypto'; // Does this fool webpack?
    polyfillCrypto(require(cryptoModule));

  }

How to convert bindings or quads to standard representations?

I've been able to use these quadstore libraries to quickly create a server for a linked data experiment. It's really fantastic work.

All the examples I've seen simply console.log the Quads or Bindings from the ResultsStream. I was hoping to find a way to convert these to the standard RDF formats: Turtle, RDF/XML, and JSON-LD. Do such utils not exist in this library? Is there some other library that would be recommended for that task?

Interface 'Engine' cannot simultaneously extend types ...

Having upgraded to 2.0.0, I am getting some unhappiness in tsc and my IDE with the typings in index.d.ts

My tsconfig compilerOptions look like this:

{
    "experimentalDecorators": true,
    "noImplicitAny": true,
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "inlineSourceMap": true,
    "declaration": true,
    "strictNullChecks": true,
    "outDir": "ext"
  }

Note that having upgraded I needed to depend on sparqlalgebrajs as it does not seem to be a dependency any more (not even a peer dep).

If it's not obvious what's going on, I'd be happy to try to put together a minimal repro.

node_modules/quadstore-comunica/index.d.ts:32:11 - error TS2320: Interface 'Engine' cannot simultaneously extend types 'StringQueryable<AllMetadataSupport, StringContext>' and 'AlgebraQueryable<Algebra, AllMetadataSupport, AlgebraContext>'.
  Named property 'query' of types 'StringQueryable<AllMetadataSupport, StringContext>' and 'AlgebraQueryable<Algebra, AllMetadataSupport, AlgebraContext>' are not identical.

32 interface Engine extends StringQueryable<AllMetadataSupport, StringContext>
             ~~~~~~

node_modules/quadstore-comunica/index.d.ts:32:11 - error TS2320: Interface 'Engine' cannot simultaneously extend types 'StringSparqlQueryable<SparqlResultSupport, StringContext>' and 'AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext>'.
  Named property 'queryBindings' of types 'StringSparqlQueryable<SparqlResultSupport, StringContext>' and 'AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext>' are not identical.

32 interface Engine extends StringQueryable<AllMetadataSupport, StringContext>
             ~~~~~~

node_modules/quadstore-comunica/index.d.ts:32:11 - error TS2320: Interface 'Engine' cannot simultaneously extend types 'StringSparqlQueryable<SparqlResultSupport, StringContext>' and 'AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext>'.
  Named property 'queryBoolean' of types 'StringSparqlQueryable<SparqlResultSupport, StringContext>' and 'AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext>' are not identical.

32 interface Engine extends StringQueryable<AllMetadataSupport, StringContext>
             ~~~~~~

node_modules/quadstore-comunica/index.d.ts:32:11 - error TS2320: Interface 'Engine' cannot simultaneously extend types 'StringSparqlQueryable<SparqlResultSupport, StringContext>' and 'AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext>'.
  Named property 'queryQuads' of types 'StringSparqlQueryable<SparqlResultSupport, StringContext>' and 'AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext>' are not identical.

32 interface Engine extends StringQueryable<AllMetadataSupport, StringContext>
             ~~~~~~

node_modules/quadstore-comunica/index.d.ts:32:11 - error TS2320: Interface 'Engine' cannot simultaneously extend types 'StringSparqlQueryable<SparqlResultSupport, StringContext>' and 'AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext>'.
  Named property 'queryVoid' of types 'StringSparqlQueryable<SparqlResultSupport, StringContext>' and 'AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext>' are not identical.

32 interface Engine extends StringQueryable<AllMetadataSupport, StringContext>
             ~~~~~~

node_modules/quadstore-comunica/index.d.ts:32:11 - error TS2395: Individual declarations in merged declaration 'Engine' must be all exported or all local.

32 interface Engine extends StringQueryable<AllMetadataSupport, StringContext>
             ~~~~~~

node_modules/quadstore-comunica/index.d.ts:33:22 - error TS2709: Cannot use namespace 'Algebra' as a type.

33   , AlgebraQueryable<Algebra, AllMetadataSupport, AlgebraContext>
                        ~~~~~~~

node_modules/quadstore-comunica/index.d.ts:35:28 - error TS2709: Cannot use namespace 'Algebra' as a type.

35   , AlgebraSparqlQueryable<Algebra, SparqlResultSupport, AlgebraContext> {}
                              ~~~~~~~

node_modules/quadstore-comunica/index.d.ts:37:15 - error TS2395: Individual declarations in merged declaration 'Engine' must be all exported or all local.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.