about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/nosql/apache-jena
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/nosql/apache-jena')
-rw-r--r--nixpkgs/pkgs/servers/nosql/apache-jena/binary.nix27
-rw-r--r--nixpkgs/pkgs/servers/nosql/apache-jena/fuseki-binary.nix46
-rw-r--r--nixpkgs/pkgs/servers/nosql/apache-jena/fuseki-test.nix18
3 files changed, 91 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/nosql/apache-jena/binary.nix b/nixpkgs/pkgs/servers/nosql/apache-jena/binary.nix
new file mode 100644
index 000000000000..a991f3fa40e7
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/apache-jena/binary.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchurl, java, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "apache-jena";
+  version = "5.0.0";
+  src = fetchurl {
+    url = "mirror://apache/jena/binaries/apache-jena-${version}.tar.gz";
+    hash = "sha256-Se47rsgp8V6Ypv0QHrwjIXrDPchM1nSl/GmUWMEvLIo=";
+  };
+  nativeBuildInputs = [
+    makeWrapper
+  ];
+  installPhase = ''
+    cp -r . "$out"
+    for i in "$out"/bin/*; do
+      wrapProgram "$i" --prefix "PATH" : "${java}/bin/"
+    done
+  '';
+  meta = with lib; {
+    description = "RDF database";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+    homepage = "https://jena.apache.org";
+    downloadPage = "https://archive.apache.org/dist/jena/binaries/";
+  };
+}
diff --git a/nixpkgs/pkgs/servers/nosql/apache-jena/fuseki-binary.nix b/nixpkgs/pkgs/servers/nosql/apache-jena/fuseki-binary.nix
new file mode 100644
index 000000000000..d748cdb7c4eb
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/apache-jena/fuseki-binary.nix
@@ -0,0 +1,46 @@
+{ lib
+, stdenv
+, fetchurl
+, java
+, coreutils
+, which
+, makeWrapper
+  # For the test
+, pkgs
+}:
+
+stdenv.mkDerivation rec {
+  pname = "apache-jena-fuseki";
+  version = "4.9.0";
+  src = fetchurl {
+    url = "mirror://apache/jena/binaries/apache-jena-fuseki-${version}.tar.gz";
+    hash = "sha256-t25Q0lb+ecR12cDD1p6eZnzLxW0kZpPOFGvo5YK7AlI=";
+  };
+  nativeBuildInputs = [
+    makeWrapper
+  ];
+  installPhase = ''
+    cp -r . "$out"
+    chmod +x $out/fuseki
+    ln -s "$out"/{fuseki-backup,fuseki-server,fuseki} "$out/bin"
+    for i in "$out"/bin/*; do
+      wrapProgram "$i" \
+        --prefix "PATH" : "${java}/bin/:${coreutils}/bin:${which}/bin" \
+        --set-default "FUSEKI_HOME" "$out" \
+        ;
+    done
+  '';
+  passthru = {
+    tests = {
+      basic-test = pkgs.callPackage ./fuseki-test.nix { };
+    };
+  };
+  meta = with lib; {
+    description = "SPARQL server";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.all;
+    homepage = "https://jena.apache.org";
+    downloadPage = "https://archive.apache.org/dist/jena/binaries/";
+  };
+}
diff --git a/nixpkgs/pkgs/servers/nosql/apache-jena/fuseki-test.nix b/nixpkgs/pkgs/servers/nosql/apache-jena/fuseki-test.nix
new file mode 100644
index 000000000000..bbf98a838259
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/apache-jena/fuseki-test.nix
@@ -0,0 +1,18 @@
+{ lib, runCommand, apache-jena-fuseki, curl }:
+runCommand "fuseki-test-${apache-jena-fuseki.name}"
+{ nativeBuildInputs = [ curl apache-jena-fuseki ]; } ''
+  export FUSEKI_BASE="$PWD/fuseki-base"
+  mkdir -p "$FUSEKI_BASE/db"
+  FUSEKI_ARGS="--update --loc=$FUSEKI_BASE/db /dataset" fuseki start
+  fuseki status
+  for i in $(seq 120); do
+      if  curl http://127.0.0.1:3030/dataset/data; then
+          break;
+      fi
+      sleep 1
+  done
+  curl -d 'update=insert+data+{+<test://subject>+<test://predicate>+<test://object>+}' http://127.0.0.1:3030/dataset/update > /dev/null
+  curl http://127.0.0.1:3030/dataset/data | grep -C999 'test://predicate'
+  curl -d 'query=select+?s+?p+?o+where+{+?s+?p+?o+.+}' http://127.0.0.1:3030/dataset/query | grep -C999 'test://predicate'
+  touch $out
+''