Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🖼 A jQuery widget to query heterogeneous interfaces using Comunica SPARQL

License

NotificationsYou must be signed in to change notification settings

comunica/jQuery-Widget.js

Repository files navigation

npm versionBuild statusDocker Automated Build

Try theComunica SPARQL jQuery Widget online.

This jQuery widget is a browser-based user interface to theComunica SPARQL client.It allows users to execute SPARQL queries over one or multiple heterogeneous interfaces, such asTriple Pattern Fragments interfaces.

The@comunica/web-client-generator allows this widget to be generated for any Comunica configuration.

Installation

This tool requiresNode.JS 10.0 or higher and is tested on OSX and Linux.

The easiest way to use this tool is by installing it from NPM as follows:

$ npm install -g @comunica/web-client-generator

Alternatively, you can install from the latest GitHub sources:

$ git clone git@github.com:comunica/jQuery-Widget.js.git

Generate jQuery widget

After installation, thecomunica-web-client-generator CLI tool allows you to generate a new widget.

If installed from the GitHub sources, use./bin/generate.js instead ofcomunica-web-client-generator.

Generating the widget for the defaultComunica SPARQL config can be done as follows:

$ comunica-web-client-generator

The output will be available in thebuild/ directory.

Provide a custom config

In order to override thedefault config, you can pass one as argument.

$ comunica-web-client-generator config/config-default.json

This assumes that your engine's dependencies are available in your working directory.If this is not the case, provide a path to your engine's directory via the-c option:

$ comunica-web-client-generator path/to/engine/config/config-default.json -c path/to/engine/

Change settings and queries

The default datasources and queries can be changed as follows:

$ comunica-web-client-generator -s settings.json -q queries

Examples for thesettings.json fileand thequeries directory.

Show all available options

All available options for this command are:

$ comunica-web-client-generator -hcomunica-web-client-generator generates Comunica Web clients  Usage:    comunica-web-client-generator config/config-default.json    comunica-web-client-generator config/config-default.json -d my-build/ -s my-settings.json    comunica-web-client-generator config/config-default.json -q my-queries/    comunica-web-client-generator config/config-default.json -w my-webpack.config.js  Options:    -b            The base URL at which the Web Client will be deployed [default: https://query.linkeddatafragments.org/]    -d            Destination of the built output (defaults to build)    -m            The compilation mode (defaults to production, can also be development)    -c            Path to the main Comunica module (defaults to cwd)    -q            Path to custom queries directory    -s            Path to custom settings file    -w            Path to custom Webpack config    --help        Print thishelp message

Running in a Docker container

Run the pre-built container

docker run -p 3000:80 -it --rm comunica/jquery-widget.js

Run from git sources

Configure your widget by editing thesettings.json file.

Next, edit thequeries directory in which you should insert the queries that will be present by default in the widget.

Build theDocker container as follows:

docker build -t comunica-sparql-widget.

After that, you can run your newly created container by mounting your current folder to the Docker container:

docker run -p 3000:80 -it --rm comunica-sparql-widget

Settings and queries can be passed at runtime by mounting your customqueries.json to the Docker container:

# Compile queries.json from settings.json and the files in the queries folder./bin/queries-to-json.js# Provide the compiled queries.json at runtimedocker run -v$(pwd)/queries.json:/usr/share/nginx/html/queries.json -p 3000:80 -it --rm comunica-sparql-widget

Access onhttp://localhost:3000

For developers of this package

The following is only relevant for developers that contribute to this package.

Using the code

  • Runyarn install to fetch dependencies and build the browser version of the client code.
  • Runyarn run dev to run a local Web server (yarn run dev-prod for minified production output).
  • Edit datasources insettings.json and queries in thequeries folder, and runqueries-to-json to compile both of them in a single JSON file.
  • Runyarn run build to generate a production version in thebuild folder.

How the browser client works

The originalComunica SPARQL engine is written for the Node.js environment. TheWebpack library makes it compatible with browsers.

The query engine itself runs in a background thread usingWeb Workers. The user interface (ldf-client-ui.js) instructs the worker (ldf-client-worker.js) to evaluate queries by sending messages, and the worker sends results back.

License

The Linked Data Fragments jQuery Widget was originally written byRuben Verborghand ported for Comunica SPARQL byRuben Taelman.

This code is copyrighted byGhent University – imecand released under theMIT license.


[8]ページ先頭

©2009-2025 Movatter.jp