diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index ddcc158d..d963f2d0 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -26,28 +26,28 @@ jobs: echo -e "\n\n[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" >> .cargo/config.toml - uses: Swatinem/rust-cache@v2 - run: cargo build --release - working-directory: ./server + working-directory: ./cli - run: cargo build --release --target aarch64-unknown-linux-gnu - working-directory: ./server + working-directory: ./cli env: BINDGEN_EXTRA_CLANG_ARGS: --sysroot /usr/aarch64-linux-gnu - uses: actions/upload-artifact@v3 with: - name: oxigraph_server_x86_64_linux_gnu - path: target/release/oxigraph_server + name: oxigraph_x86_64_linux_gnu + path: target/release/oxigraph - uses: actions/upload-artifact@v3 with: - name: oxigraph_server_aarch64_linux_gnu - path: target/aarch64-unknown-linux-gnu/release/oxigraph_server - - run: mv target/release/oxigraph_server oxigraph_server_${{ github.event.release.tag_name }}_x86_64_linux_gnu + name: oxigraph_aarch64_linux_gnu + path: target/aarch64-unknown-linux-gnu/release/oxigraph + - run: mv target/release/oxigraph oxigraph_${{ github.event.release.tag_name }}_x86_64_linux_gnu if: github.event_name == 'release' - - run: mv target/aarch64-unknown-linux-gnu/release/oxigraph_server oxigraph_server_${{ github.event.release.tag_name }}_aarch64_linux_gnu + - run: mv target/aarch64-unknown-linux-gnu/release/oxigraph oxigraph_${{ github.event.release.tag_name }}_aarch64_linux_gnu if: github.event_name == 'release' - uses: softprops/action-gh-release@v1 with: files: | - oxigraph_server_${{ github.event.release.tag_name }}_x86_64_linux_gnu - oxigraph_server_${{ github.event.release.tag_name }}_aarch64_linux_gnu + oxigraph_${{ github.event.release.tag_name }}_x86_64_linux_gnu + oxigraph_${{ github.event.release.tag_name }}_aarch64_linux_gnu if: github.event_name == 'release' binary_mac: @@ -63,26 +63,26 @@ jobs: - run: rustup update && rustup target add aarch64-apple-darwin - uses: Swatinem/rust-cache@v2 - run: cargo build --release - working-directory: ./server + working-directory: ./cli - run: cargo build --release --target aarch64-apple-darwin - working-directory: ./server + working-directory: ./cli - uses: actions/upload-artifact@v3 with: - name: oxigraph_server_x86_64_apple - path: target/release/oxigraph_server + name: oxigraph_x86_64_apple + path: target/release/oxigraph - uses: actions/upload-artifact@v3 with: - name: oxigraph_server_aarch64_apple - path: target/aarch64-apple-darwin/release/oxigraph_server - - run: mv target/release/oxigraph_server oxigraph_server_${{ github.event.release.tag_name }}_x86_64_apple + name: oxigraph_aarch64_apple + path: target/aarch64-apple-darwin/release/oxigraph + - run: mv target/release/oxigraph oxigraph_${{ github.event.release.tag_name }}_x86_64_apple if: github.event_name == 'release' - - run: mv target/aarch64-apple-darwin/release/oxigraph_server oxigraph_server_${{ github.event.release.tag_name }}_aarch64_apple + - run: mv target/aarch64-apple-darwin/release/oxigraph oxigraph_${{ github.event.release.tag_name }}_aarch64_apple if: github.event_name == 'release' - uses: softprops/action-gh-release@v1 with: files: | - oxigraph_server_${{ github.event.release.tag_name }}_x86_64_apple - oxigraph_server_${{ github.event.release.tag_name }}_aarch64_apple + oxigraph_${{ github.event.release.tag_name }}_x86_64_apple + oxigraph_${{ github.event.release.tag_name }}_aarch64_apple if: github.event_name == 'release' binary_windows: @@ -95,16 +95,16 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse - run: cargo build --release - working-directory: ./server + working-directory: ./cli - uses: actions/upload-artifact@v3 with: - name: oxigraph_server_x86_64_windows_msvc - path: target/release/oxigraph_server.exe - - run: mv target/release/oxigraph_server.exe oxigraph_server_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe + name: oxigraph_x86_64_windows_msvc + path: target/release/oxigraph.exe + - run: mv target/release/oxigraph.exe oxigraph_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe if: github.event_name == 'release' - uses: softprops/action-gh-release@v1 with: - files: oxigraph_server_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe + files: oxigraph_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe if: github.event_name == 'release' wheel_linux: @@ -337,7 +337,7 @@ jobs: working-directory: ./lib continue-on-error: true - run: cargo publish - working-directory: ./server + working-directory: ./cli homebrew: if: "github.event_name == 'release' && !contains('-', github.event.release.tag_name)" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b16ea777..edf5cd42 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,7 +51,7 @@ jobs: - run: cargo clippy working-directory: ./python - run: cargo clippy - working-directory: ./server + working-directory: ./cli - run: cargo clippy working-directory: ./testsuite @@ -119,7 +119,7 @@ jobs: - run: cargo clippy -- -D warnings -D clippy::all working-directory: ./python - run: cargo clippy -- -D warnings -D clippy::all - working-directory: ./server + working-directory: ./cli - run: cargo clippy -- -D warnings -D clippy::all working-directory: ./testsuite @@ -164,7 +164,7 @@ jobs: - run: rustup update - uses: Swatinem/rust-cache@v2 - run: cargo install cargo-semver-checks || true - - run: cargo semver-checks check-release --exclude oxrocksdb-sys --exclude oxigraph_js --exclude pyoxigraph --exclude oxigraph_testsuite --exclude oxigraph_server + - run: cargo semver-checks check-release --exclude oxrocksdb-sys --exclude oxigraph-js --exclude pyoxigraph --exclude oxigraph-testsuite --exclude oxigraph-cli test_linux: runs-on: ubuntu-latest @@ -187,7 +187,7 @@ jobs: - run: rustup update && rustup override set nightly - run: sudo apt install -y llvm - uses: Swatinem/rust-cache@v2 - - run: cargo test --tests --target x86_64-unknown-linux-gnu --workspace --exclude pyoxigraph --exclude oxigraph_testsuite --exclude oxigraph_server + - run: cargo test --tests --target x86_64-unknown-linux-gnu --workspace --exclude pyoxigraph --exclude oxigraph-testsuite --exclude oxigraph-cli env: RUST_BACKTRACE: 1 RUSTFLAGS: -Z sanitizer=address @@ -215,7 +215,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@wasmtime - run: cargo install cargo-wasi || true - - run: cargo wasi test --workspace --exclude oxigraph_js --exclude oxigraph_server --exclude oxigraph_testsuite --exclude oxrocksdb-sys --exclude pyoxigraph + - run: cargo wasi test --workspace --exclude oxigraph-js --exclude oxigraph-cli --exclude oxigraph-testsuite --exclude oxrocksdb-sys --exclude pyoxigraph env: RUST_BACKTRACE: 1 diff --git a/Cargo.lock b/Cargo.lock index b4db7cbd..63a066a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -973,17 +973,7 @@ dependencies = [ ] [[package]] -name = "oxigraph_js" -version = "0.4.0-alpha.1-dev" -dependencies = [ - "console_error_panic_hook", - "js-sys", - "oxigraph", - "wasm-bindgen", -] - -[[package]] -name = "oxigraph_server" +name = "oxigraph-cli" version = "0.4.0-alpha.1-dev" dependencies = [ "anyhow", @@ -1002,7 +992,17 @@ dependencies = [ ] [[package]] -name = "oxigraph_testsuite" +name = "oxigraph-js" +version = "0.4.0-alpha.1-dev" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "oxigraph", + "wasm-bindgen", +] + +[[package]] +name = "oxigraph-testsuite" version = "0.4.0-alpha.1-dev" dependencies = [ "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 15d79ef4..8264afa9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ members = [ "lib/sparql-smith", "oxrocksdb-sys", "python", - "server", + "cli", "testsuite" ] resolver = "2" @@ -30,5 +30,5 @@ rust-version = "1.70" lto = true codegen-units = 1 -[profile.release.package.oxigraph_js] +[profile.release.package.oxigraph-js] opt-level = "z" diff --git a/README.md b/README.md index 7be322f6..55a39b10 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ It is split into multiple parts: - [`pyoxigraph` that exposes Oxigraph to the Python world](https://pyoxigraph.readthedocs.io/). Its source code is in the `python` directory. [![PyPI](https://img.shields.io/pypi/v/pyoxigraph)](https://pypi.org/project/pyoxigraph/) - [JavaScript bindings for Oxigraph](https://www.npmjs.com/package/oxigraph). WebAssembly is used to package Oxigraph into a NodeJS compatible NPM package. Its source code is in the `js` directory. [![npm](https://img.shields.io/npm/v/oxigraph)](https://www.npmjs.com/package/oxigraph) -- [Oxigraph server](https://crates.io/crates/oxigraph_server) that provides a standalone binary of a web server implementing the [SPARQL 1.1 Protocol](https://www.w3.org/TR/sparql11-protocol/) and the [SPARQL 1.1 Graph Store Protocol](https://www.w3.org/TR/sparql11-http-rdf-update/). Its source code is in the `server` directory. - [![Latest Version](https://img.shields.io/crates/v/oxigraph_server.svg)](https://crates.io/crates/oxigraph_server) +- [Oxigraph binary](https://crates.io/crates/oxigraph-cli) that provides a standalone command line tool allowing to manipulate RDF data and spawn a a web server implementing the [SPARQL 1.1 Protocol](https://www.w3.org/TR/sparql11-protocol/) and the [SPARQL 1.1 Graph Store Protocol](https://www.w3.org/TR/sparql11-http-rdf-update/). Its source code is in the `cli` directory. + [![Latest Version](https://img.shields.io/crates/v/oxigraph-cli.svg)](https://crates.io/crates/oxigraph-cli) Oxigraph implements the following specifications: diff --git a/bench/bsbm_oxigraph.sh b/bench/bsbm_oxigraph.sh index 7ee691cb..a4b15201 100755 --- a/bench/bsbm_oxigraph.sh +++ b/bench/bsbm_oxigraph.sh @@ -6,10 +6,10 @@ PARALLELISM=16 set -eu cd bsbm-tools ./generate -fc -pc ${DATASET_SIZE} -s nt -fn "explore-${DATASET_SIZE}" -ud -ufn "explore-update-${DATASET_SIZE}" -cargo build --release --manifest-path="../../server/Cargo.toml" -VERSION=$(./../../target/release/oxigraph_server --version | sed 's/oxigraph_server //g') -./../../target/release/oxigraph_server --location oxigraph_data load --file "explore-${DATASET_SIZE}.nt" -./../../target/release/oxigraph_server --location oxigraph_data serve --bind 127.0.0.1:7878 & +cargo build --release --manifest-path="../../cli/Cargo.toml" +VERSION=$(./../../target/release/oxigraph --version | sed 's/oxigraph //g') +./../../target/release/oxigraph --location oxigraph_data load --file "explore-${DATASET_SIZE}.nt" +./../../target/release/oxigraph --location oxigraph_data serve --bind 127.0.0.1:7878 & sleep 1 ./testdriver -mt ${PARALLELISM} -ucf usecases/explore/sparql.txt -o "../bsbm.explore.oxigraph.${VERSION}.${DATASET_SIZE}.${PARALLELISM}.xml" http://127.0.0.1:7878/query ./testdriver -mt ${PARALLELISM} -ucf usecases/exploreAndUpdate/sparql.txt -o "../bsbm.exploreAndUpdate.oxigraph.${VERSION}.${DATASET_SIZE}.${PARALLELISM}.xml" http://127.0.0.1:7878/query -u http://127.0.0.1:7878/update -udataset "explore-update-${DATASET_SIZE}.nt" diff --git a/server/Cargo.toml b/cli/Cargo.toml similarity index 74% rename from server/Cargo.toml rename to cli/Cargo.toml index 350863f9..62c6b40b 100644 --- a/server/Cargo.toml +++ b/cli/Cargo.toml @@ -1,19 +1,23 @@ [package] -name = "oxigraph_server" +name = "oxigraph-cli" version.workspace = true authors.workspace = true license.workspace = true readme = "README.md" keywords = ["RDF", "SPARQL", "graph-database", "database"] categories = ["command-line-utilities", "database"] -repository = "https://github.com/oxigraph/oxigraph/tree/main/server" -homepage = "https://oxigraph.org/server/" +repository = "https://github.com/oxigraph/oxigraph/tree/main/cli" +homepage = "https://oxigraph.org/cli/" description = """ -Oxigraph SPARQL HTTP server +Oxigraph command line toolkit and SPARQL HTTP server """ edition.workspace = true rust-version.workspace = true +[[bin]] +name = "oxigraph" +path = "src/main.rs" + [dependencies] anyhow = "1" oxhttp = { version = "0.1", features = ["rayon"] } diff --git a/server/Dockerfile b/cli/Dockerfile similarity index 80% rename from server/Dockerfile rename to cli/Dockerfile index 92a6f4d4..abbd6aad 100644 --- a/server/Dockerfile +++ b/cli/Dockerfile @@ -8,18 +8,18 @@ RUN apt-get update && \ rustup target add aarch64-unknown-linux-gnu ; \ fi COPY . /oxigraph -WORKDIR /oxigraph/server +WORKDIR /oxigraph/cli RUN if [ "$BUILDARCH" != "$TARGETARCH" ] && [ "$TARGETARCH" = "arm64" ] ; \ then \ export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc && \ export BINDGEN_EXTRA_CLANG_ARGS="--sysroot /usr/aarch64-linux-gnu" && \ cargo build --release --target aarch64-unknown-linux-gnu && \ - mv /oxigraph/target/aarch64-unknown-linux-gnu/release/oxigraph_server /oxigraph/target/release/oxigraph_server ; \ + mv /oxigraph/target/aarch64-unknown-linux-gnu/release/oxigraph /oxigraph/target/release/oxigraph ; \ else \ cargo build --release ; \ fi FROM --platform=$TARGETPLATFORM gcr.io/distroless/cc-debian11 -COPY --from=builder /oxigraph/target/release/oxigraph_server /usr/local/bin/oxigraph_server -ENTRYPOINT [ "/usr/local/bin/oxigraph_server" ] +COPY --from=builder /oxigraph/target/release/oxigraph /usr/local/bin/oxigraph +ENTRYPOINT [ "/usr/local/bin/oxigraph" ] CMD [ "serve", "--location", "/data", "--bind", "0.0.0.0:7878" ] diff --git a/server/README.md b/cli/README.md similarity index 84% rename from server/README.md rename to cli/README.md index 28a06073..8c650b4f 100644 --- a/server/README.md +++ b/cli/README.md @@ -1,17 +1,15 @@ -Oxigraph Server -=============== +Oxigraph CLI +============ -[![Latest Version](https://img.shields.io/crates/v/oxigraph_server.svg)](https://crates.io/crates/oxigraph_server) -[![Crates.io downloads](https://img.shields.io/crates/d/oxigraph_server)](https://crates.io/crates/oxigraph_server) +[![Latest Version](https://img.shields.io/crates/v/oxigraph-cli.svg)](https://crates.io/crates/oxigraph-cli) +[![Crates.io downloads](https://img.shields.io/crates/d/oxigraph-cli)](https://crates.io/crates/oxigraph-cli) [![Conda](https://img.shields.io/conda/vn/conda-forge/oxigraph-server)](https://anaconda.org/conda-forge/oxigraph-server) [![actions status](https://github.com/oxigraph/oxigraph/workflows/build/badge.svg)](https://github.com/oxigraph/oxigraph/actions) [![Gitter](https://badges.gitter.im/oxigraph/community.svg)](https://gitter.im/oxigraph/community) -Oxigraph Server is a standalone HTTP server providing a graph database implementing the [SPARQL](https://www.w3.org/TR/sparql11-overview/) standard. - -Its goal is to provide a compliant, safe, and fast graph database based on the [RocksDB](https://rocksdb.org/) key-value store. -It is written in Rust. -It also provides a set of utility functions for reading, writing, and processing RDF files. +Oxigraph CLI is a graph database implementing the [SPARQL](https://www.w3.org/TR/sparql11-overview/) standard. +It is packaged as a command line tool allowing to manipulate an RDF files, query them using SPARQL... +It also allows to spawn a HTTP server on top of the database. Oxigraph is in heavy development and SPARQL query evaluation has not been optimized yet. @@ -36,15 +34,15 @@ A preliminary benchmark [is provided](../bench/README.md). You need to have [a recent stable version of Rust and Cargo installed](https://www.rust-lang.org/tools/install). -To download, build and install the latest released version run `cargo install oxigraph_server`. +To download, build and install the latest released version run `cargo install oxigraph-cli`. There is no need to clone the git repository. -To compile the server from source, clone this git repository including its submodules (`git clone --recursive https://github.com/oxigraph/oxigraph.git`), and execute `cargo build --release` in the `server` directory to compile the full server after having downloaded its dependencies. -It will create a fat binary in `target/release/oxigraph_server`. +To compile the command line tool from source, clone this git repository including its submodules (`git clone --recursive https://github.com/oxigraph/oxigraph.git`), and execute `cargo build --release` in the `cli` directory to compile the full binary after having downloaded its dependencies. +It will create a fat binary in `target/release/oxigraph`. ## Usage -Run `oxigraph_server serve --location my_data_storage_directory` to start the server where `my_data_storage_directory` is the directory where you want Oxigraph data to be stored. It listens by default on `localhost:7878`. +Run `oxigraph serve --location my_data_storage_directory` to start the server where `my_data_storage_directory` is the directory where you want Oxigraph data to be stored. It listens by default on `localhost:7878`. The server provides an HTML UI, based on [YASGUI](https://yasgui.triply.cc), with a form to execute SPARQL requests. @@ -78,10 +76,10 @@ It provides the following REST actions: ``` will add the N-Quads file `MY_FILE.nq` to the server dataset. -Use `oxigraph_server --help` to see the possible options when starting the server. +Use `oxigraph --help` to see the possible options when starting the server. It is also possible to load RDF data offline using bulk loading: -`oxigraph_server load --location my_data_storage_directory --file my_file.nq` +`oxigraph load --location my_data_storage_directory --file my_file.nq` ## Using a Docker image @@ -217,14 +215,14 @@ To install Oxigraph server using Homebrew do: brew tap oxigraph/oxigraph brew install oxigraph ``` -It installs the `oxigraph_server` binary. [See the usage documentation to know how to use it](#usage). +It installs the `oxigraph` binary. [See the usage documentation to know how to use it](#usage). ## Systemd It is possible to run Oxigraph in the background using systemd. -For that, you can use the following `oxigraph_server.service` file (it might be inserted into `/etc/systemd/system/` or `$HOME/.config/systemd/user`): +For that, you can use the following `oxigraph.service` file (it might be inserted into `/etc/systemd/system/` or `$HOME/.config/systemd/user`): ```ini [Unit] Description=Oxigraph database server @@ -233,7 +231,7 @@ Wants=network-online.target [Service] Type=notify -ExecStart=/PATH/TO/oxigraph_server serve --location /PATH/TO/OXIGRAPH/DATA +ExecStart=/PATH/TO/oxigraph serve --location /PATH/TO/OXIGRAPH/DATA [Install] WantedBy=multi-user.target @@ -242,8 +240,8 @@ WantedBy=multi-user.target ## Migration guide ### From 0.2 to 0.3 -* The cli API has been completely rewritten. To start the server run `oxigraph_server serve --location MY_STORAGE` instead of `oxigraph_server --file MY_STORAGE`. -* Fast data bulk loading is not supported using `oxigraph_server load --location MY_STORAGE --file MY_FILE`. The file format is guessed from the extension (`.nt`, `.ttl`, `.nq`...). +* The cli API has been completely rewritten. To start the server run `oxigraph serve --location MY_STORAGE` instead of `oxigraph --file MY_STORAGE`. +* Fast data bulk loading is not supported using `oxigraph load --location MY_STORAGE --file MY_FILE`. The file format is guessed from the extension (`.nt`, `.ttl`, `.nq`...). * [RDF-star](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html) is now implemented. * All operations are now transactional using the "repeatable read" isolation level: the store only exposes changes that have been "committed" (i.e. no partial writes) diff --git a/server/logo.svg b/cli/logo.svg similarity index 100% rename from server/logo.svg rename to cli/logo.svg diff --git a/server/src/main.rs b/cli/src/main.rs similarity index 99% rename from server/src/main.rs rename to cli/src/main.rs index 817fed04..5095076d 100644 --- a/server/src/main.rs +++ b/cli/src/main.rs @@ -38,8 +38,8 @@ const HTML_ROOT_PAGE: &str = include_str!("../templates/query.html"); const LOGO: &str = include_str!("../logo.svg"); #[derive(Parser)] -#[command(about, version)] -/// Oxigraph SPARQL server. +#[command(about, version, name = "oxigraph")] +/// Oxigraph command line toolkit and SPARQL HTTP server. struct Args { #[command(subcommand)] command: Command, @@ -1830,7 +1830,7 @@ mod tests { fn cli_command() -> Result { Ok(Command::from_std( escargot::CargoBuild::new() - .bin(env!("CARGO_PKG_NAME")) + .bin("oxigraph") .manifest_path(format!("{}/Cargo.toml", env!("CARGO_MANIFEST_DIR"))) .run()? .command(), diff --git a/server/templates/query.html b/cli/templates/query.html similarity index 100% rename from server/templates/query.html rename to cli/templates/query.html diff --git a/js/Cargo.toml b/js/Cargo.toml index 0b3f5738..0fa31d8f 100644 --- a/js/Cargo.toml +++ b/js/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "oxigraph_js" +name = "oxigraph-js" version.workspace = true authors.workspace = true license.workspace = true diff --git a/lib/README.md b/lib/README.md index 9b7f1de3..d2afa1bc 100644 --- a/lib/README.md +++ b/lib/README.md @@ -14,7 +14,7 @@ It also provides a set of utility functions for reading, writing, and processing Oxigraph is in heavy development and SPARQL query evaluation has not been optimized yet. -Oxigraph also provides [a standalone HTTP server](https://crates.io/crates/oxigraph_server) and [a Python library](https://pyoxigraph.readthedocs.io/) based on this library. +Oxigraph also provides [a standalone HTTP server](https://crates.io/crates/oxigraph-cli) and [a Python library](https://pyoxigraph.readthedocs.io/) based on this library. Oxigraph implements the following specifications: diff --git a/server b/server new file mode 120000 index 00000000..76ec9f59 --- /dev/null +++ b/server @@ -0,0 +1 @@ +cli \ No newline at end of file diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml index a25a27dc..3a473001 100644 --- a/testsuite/Cargo.toml +++ b/testsuite/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "oxigraph_testsuite" +name = "oxigraph-testsuite" version.workspace = true authors.workspace = true license.workspace = true