calcite-sparql
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
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.0%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: nvitucci
- License: apache-2.0
- Language: Java
- Default Branch: main
- Size: 60.5 KB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
Calcite SPARQL adapter
This adapter can be used to execute SQL queries over a SPARQL endpoint via Apache Calcite and Apache Jena. The project is a work in progress and it is not meant to be run in production.
Description
The adapter can be used in several modes to expose the RDF data in a SPARQL endpoint as data:
- the
propertymode, which exposes every RDF property (the?pof a?s ?p ?opattern) as a table with two columnss(subject) ando(object); - the
classmode, which exposes every RDF class (the?clof a?s rdf:type ?clpattern) as a table whose columns are all the properties that link items of such class (the?sof the same pattern) to objects; - the
mappingmode, where selected properties are directly mapped to columns of a specified table.
Example of the model file
The SPARQL endpoint in the following examples is a Jena in-memory endpoint created from a local file. Replace with e.g. "jdbc:jena:remote:query=https://dbpedia.org/sparql" to use a remote endpoint.
Using the
propertymode:json { "version": "1.0", "defaultSchema": "sparql", "schemas": [ { "name": "sparql", "type": "custom", "factory": "com.datagrafting.sql2sparql.calcite.SparqlSchemaFactory", "operand": { "endpoint": "jdbc:jena:mem:dataset=data.nq", "tableMode": "property" } } ] }Using the
classmode:
json
{
"version": "1.0",
"defaultSchema": "sparql",
"schemas": [
{
"name": "sparql",
"type": "custom",
"factory": "com.datagrafting.sql2sparql.calcite.SparqlSchemaFactory",
"operand": {
"endpoint": "jdbc:jena:mem:dataset=data.nq",
"tableMode": "class"
}
}
]
}
- Using the
mappingmode:
json
{
"version": "1.0",
"defaultSchema": "sparql",
"schemas": [
{
"name": "sparql",
"type": "custom",
"factory": "com.datagrafting.sql2sparql.calcite.SparqlSchemaFactory",
"operand": {
"endpoint": "jdbc:jena:mem:dataset=data.nq",
"tableMode": "mapping",
"tableMappings": [
{
"name": "Person",
"columns": [
{
"name": "name",
"property": "http://xmlns.com/foaf/0.1/name"
},
{
"name": "age",
"property": "http://xmlns.com/foaf/0.1/age"
}
]
}
]
}
}
]
}
Basic Usage
- Java example
- Python (Jupyter notebook) examples using jaydebeapi and Apache Arrow
Running the examples
Compile the main library using Java 11:
shell
cd core
mvn clean package -DskipTests
cd ..
or using Java 8:
shell
cd core
mvn clean package -P java1.8 -DskipTests
cd ..
Please note that compiling with Java 8 forces Jena version to 3.17.0 (last version before switching to Java 11).
For the Java examples:
shell
cd example
mv clean package
/path/to/java -cp target/classes:../../core/target/calcite-sparql-core-0.0.1-SNAPSHOT.jar com.datagrafting.sql2sparql.examples.SparqlClassTableRemote
For the Python examples, Python 3 and Jupyter Notebook need to be installed first. Then, the notebooks can be run from the examples/python directory.
Pushed-down SQL constructs
SELECT *andSELECTwith any number of columnsWHERE(with=,<>,<,>,<=,>=)ORDER BYLIMIT
Releasing
When releasing, please make sure to update both the changelog and the citation file.
Citing the project
If you use this project in an article, please cite it as specified in the CITATION.cff file.
Acknowledgements
Many thanks to:
- Paul Jackson for interesting discussions on the mapping from RDF to SQL schema.
Owner
- Name: Nicola Vitucci
- Login: nvitucci
- Kind: user
- Repositories: 12
- Profile: https://github.com/nvitucci
Citation (CITATION.cff)
cff-version: 1.2.0
title: calcite-sparql
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Nicola
family-names: Vitucci
email: nicola.vitucci@gmail.com
repository-code: "https://github.com/nvitucci/calcite-sparql"
version: 0.0.1
date-released: 2022-01-23
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- com.google.guava:guava 31.0.1-jre
- org.apache.arrow:arrow-jdbc 6.0.1
- org.apache.arrow:arrow-memory 6.0.1
- org.apache.calcite:calcite-core 1.29.0
- org.apache.jena:jena-jdbc-driver-remote 4.4.0
- org.apache.jena:jena-jdbc-driver-mem 4.4.0 test
- org.assertj:assertj-core 3.22.0 test
- org.junit.jupiter:junit-jupiter-api 5.8.2 test
- org.junit.jupiter:junit-jupiter-engine 5.8.2 test