sparql2nemo
SPARQL2NEMO Translates a given SPARQL Query to Nemo Code
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.6%) to scientific vocabulary
Repository
SPARQL2NEMO Translates a given SPARQL Query to Nemo Code
Basic Info
- Host: GitHub
- Owner: eilmiv
- License: mit
- Language: Rust
- Default Branch: master
- Size: 3.35 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
SPARQL2NEMO Converter
Transforms a given SPARQL query to Nemo code. The program works by transforming operations of the SPARQL algebra recursively. Translation to SPARQL algebra uses spargebra which is developed as part of the Oxigraph graph database.
Supported Features
Translation implementations for SPARQL Features can be found in translation.rs. A German explanation how the Translation works is included in the Repository. Functions are generally named after the SPARQL algebra operation they translate.
There are special suffixes for functions that do not produce solution sets:
- *_seq for solution sequence: first position of resulting predicate is index in solution sequence
- *_multi for solution multiset (a.k.a. unordered solution sequence): first position of resulting predicate is multiplicity
- *_g for generic implementations supporting multiple types of solutions
- *_multi_g for generic implementations supporting solution multiset and regular solution sets
- *_seq_g for generic implementations supporting solution sequences and regular solutions sets
You may also look at the example queries in tests.rs.
Known differences to SPARQL 1.1 Query standard
- No support for
FROMclause and other graph management features - No support for using variables in an
EXISTSexpression that are only defined outside theEXISTSexpression - Empty
In-expression can error e.g.0/0 in ()evaluates to an error but should befalse DISTINCTandREDUCEDdo not preserve orders previously given byORDER BY- In some cases an incorrect type of equality is used - explicit equality checking and graph pattern matching should work correctly
GROUP BYdoes not support grouping by all variables simultaneously- Some symbols in variable names may be not supported
- Literals may not be handled completely in line with SPARQL
- Nemo applies some normalization to literals which may change results in some cases, there are no malformed literals
- Nemo does not apply numeric type promotion and subtype substitution rules from SPARQL
- Function and operators may not have standard compliant input/output types
- Only minimal support for
xsd:decimal - Only minimal support for language tagged strings
- Some functions and aggregations are not implemented
- Comparisons do not work for Datetime values
- Some Nemo functions are not Standard compliant e.g. Nemo uses a simpler regex syntax
Usage
There is no explicit UI.
The output NEMO program is printed to stdout and needs to be combined with the graph data and executed manually.
The input graph is currently provided in NEMO as the ternary predicate input_graph(?subject, ?predicate, ?object).
Select a mode by calling the desired function in main():
- _test_translation(): Converts a SPARQL query (supplied as query_str) to NEMO program
- _test_parsing(): Converts a SPARQL query (query_str) to SPARQL algebra
- _test_rust(): For trying out some Rust features
- _test_model(): For trying out the Rust macro based NEMO templating language
- _translate_stdin(): For reading SPARQL query from stdin printing NEMO translation to stdout
Run the code using:
bash
cargo +nightly run
You may need to install the following packages if you don't have them already (Ubuntu):
bash
sudo apt update
sudo apt install pkg-config
sudo apt install libssl-dev
Tests need to be run with RUST_TEST_THREADS=1 environment variable because Nemo uses timing locks where it is unknown
how multithreading is supported with this.
Note that this code works with an old version of Nemo
Translate queries from stdin
- Ensure the
_translate_stdin()function is called in main. - Build using
cargo +nightly build --release - Use using
echo "ASK {?a ?b ?c}" | ./target/release/sparql2nemo - Translation is written to stdout
Owner
- Name: Martin Voigt
- Login: eilmiv
- Kind: user
- Repositories: 1
- Profile: https://github.com/eilmiv
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: SPARQL2NEMO
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Martin
family-names: Voigt
orcid: 'https://orcid.org/0000-0001-5556-838X'
affiliation: TU Dresden
abstract: >-
SPARQL2NEMO Transforms a given SPARQL query to Nemo code.
The program works by transforming operations of the SPARQL
algebra recursively.
license: MIT
GitHub Events
Total
- Push event: 8
- Create event: 2
Last Year
- Push event: 8
- Create event: 2
Dependencies
- 231 dependencies