-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
1,766 additions
and
834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
.settings | ||
target | ||
|
||
*.jar | ||
|
||
pom.xml.versionBackup | ||
pom.xml.versionsBackup | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
FROM maven:3-jdk-11 as build | ||
# IMPORTANT: This dockerfile is merely a fallback! | ||
# The recommended way to build a docker image from this java project is using the jib maven plugin | ||
# on the module lsq-pkg-docker-cli: | ||
# mvn clean install | ||
# mvn -pl :lsq-pkg-docker-cli jib:dockerBuild | ||
|
||
# Building this Dockerfile requires buildkit: | ||
# Ensure { "features": { "buildkit": true } } exists in /etc/docker/daemon.json | ||
# (or wherever your deamon.json resides) | ||
|
||
COPY . . | ||
RUN mvn -Pdist,standalone clean install | ||
ARG home="/lsq" | ||
|
||
FROM maven:3-jdk-11 as build | ||
ARG home | ||
ENV HOME "$home" | ||
RUN mkdir -p "$HOME" | ||
WORKDIR "$HOME" | ||
ADD . "$HOME" | ||
RUN --mount=type=cache,target=/root/.m2 mvn -Pdist,standalone clean install | ||
|
||
# Final running image | ||
FROM openjdk:11-jre-slim | ||
|
||
ARG home | ||
ENV HOME "$home" | ||
# Import the lsq-cli jar from the build step | ||
COPY --from=build lsq-cli/target/lsq-cli-*-jar-with-dependencies.jar /app/lsq-cli.jar | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y wget | ||
|
||
# # Install Spark for standalone context in /opt | ||
# ENV APACHE_SPARK_VERSION=3.2.0 | ||
# ENV HADOOP_VERSION=3.2 | ||
# ENV SPARK_HOME=/opt/spark | ||
# ENV SPARK_OPTS="--driver-java-options=-Xms1024M --driver-java-options=-Xmx2048M --driver-java-options=-Dlog4j.logLevel=info" | ||
# RUN wget -q -O spark.tgz https://archive.apache.org/dist/spark/spark-${APACHE_SPARK_VERSION}/spark-${APACHE_SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}.tgz && \ | ||
# tar xzf spark.tgz -C /opt && \ | ||
# rm "spark.tgz" && \ | ||
# ln -s "/opt/spark-${APACHE_SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}" $SPARK_HOME | ||
|
||
COPY --from=build "$HOME/lsq-pkg-parent/lsq-pkg-uberjar-cli/target/"lsq-pkg-uberjar-cli-*-jar-with-dependencies.jar "$HOME/lsq-cli.jar" | ||
|
||
# Using /data as working directory that will be shared with host for input/output files | ||
WORKDIR /data | ||
VOLUME [ "/data" ] | ||
|
||
ENTRYPOINT ["java","-jar","/app/lsq-cli.jar"] | ||
ENTRYPOINT ["java","-jar","$HOME/lsq-cli.jar"] | ||
CMD ["-h"] | ||
|
||
# Usage: | ||
# docker run -it -v $(pwd):/data ghcr.io/aksw/lsq rx rdfize --endpoint=http://dbpedia.org/sparql virtuoso.dbpedia.log | ||
# docker run -it -v $(pwd):/data ghcr.io/aksw/lsq rx rdfize --endpoint=http://dbpedia.org/sparql virtuoso.dbpedia.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
CWD = $(shell pwd) | ||
|
||
POM = -f pom.xml | ||
# Maven Clean Install Skip ; skip tests, javadoc, scaladoc, etc | ||
MS = mvn -DskipTests -Dmaven.javadoc.skip=true -Dskip | ||
MCIS = $(MS) clean install | ||
MCCS = $(MS) clean compile | ||
|
||
VER = $(error specify VER=releasefile-name e.g. VER=1.9.7-rc2) | ||
loud = echo "@@" $(1);$(1) | ||
|
||
# Source: https://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile | ||
.PHONY: help | ||
|
||
.ONESHELL: | ||
help: ## Show these help instructions | ||
@sed -rn 's/^([a-zA-Z_-]+):.*?## (.*)$$/"\1" "\2"/p' < $(MAKEFILE_LIST) | xargs printf "make %-20s# %s\n" | ||
|
||
distjar: ## Create only the standalone jar-with-dependencies of rpt | ||
$(MCCS) $(POM) package -Pstandalone,dist -pl :lsq-pkg-uberjar-cli -am $(ARGS) | ||
file=`find '$(CWD)/lsq-pkg-parent/lsq-pkg-uberjar-cli/target' -name '*-jar-with-dependencies.jar'` | ||
printf '\nCreated package:\n\n%s\n\n' "$$file" | ||
|
||
rpm-rebuild: ## Rebuild the rpm package (minimal build of only required modules) | ||
$(MCIS) $(POM) -Prpm -am -pl :lsq-pkg-rpm-cli $(ARGS) | ||
|
||
rpm-reinstall: ## Reinstall rpm (requires prior build) | ||
@p1=`find lsq-pkg-parent/lsq-pkg-rpm-cli/target | grep '\.rpm$$'` | ||
sudo rpm -U "$$p1" | ||
|
||
rpm-rere: rpm-rebuild rpm-reinstall ## Rebuild and reinstall rpm package | ||
|
||
|
||
deb-rebuild: ## Rebuild the deb package (minimal build of only required modules) | ||
$(MCIS) $(POM) -Pdeb -am -pl :lsq-pkg-deb-cli $(ARGS) | ||
|
||
deb-reinstall: ## Reinstall deb (requires prior build) | ||
@p1=`find lsq-pkg-parent/lsq-pkg-deb-cli/target | grep '\.deb$$'` | ||
sudo dpkg -i "$$p1" | ||
|
||
deb-rere: deb-rebuild deb-reinstall ## Rebuild and reinstall deb package | ||
|
||
|
||
docker: ## Build Docker image | ||
$(MCIS) $(POM) -am -pl :lsq-pkg-docker-cli $(ARGS) | ||
cd lsq-pkg-parent/lsq-pkg-docker-cli && $(MS) jib:dockerBuild && cd ../.. | ||
|
||
release-bundle: ## Create files for Github upload | ||
@set -eu | ||
ver=$(VER) | ||
$(call loud,$(MAKE) deb-rebuild) | ||
p1=`find lsq-pkg-parent/lsq-pkg-deb-cli/target | grep '\.deb$$'` | ||
$(call loud,cp "$$p1" "rpt-$${ver/-/\~}.deb") | ||
$(call loud,$(MAKE) rpm-rebuild) | ||
p1=`find lsq-pkg-parent/lsq-pkg-rpm-cli/target | grep '\.rpm$$'` | ||
$(call loud,cp "$$p1" "rpt-$$ver.rpm") | ||
$(call loud,$(MAKE) distjar) | ||
file=`find '$(CWD)/lsq-pkg-parent/lsq-pkg-uberjar-cli/target' -name '*-jar-with-dependencies.jar'` | ||
$(call loud,cp "$$file" "rpt-$$ver.jar") | ||
$(call loud,$(MAKE) docker) | ||
$(call loud,docker tag aksw/rpt aksw/rpt:$$ver) | ||
$(call loud,gh release create v$$ver "rpt-$${ver/-/\~}.deb" "rpt-$$ver.rpm" "rpt-$$ver.jar") | ||
$(call loud,docker push aksw/rpt:$$ver) | ||
$(call loud,docker push aksw/rpt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# IMPORTANT: This dockerfile is merely a fallback! | ||
# The recommended way to build a docker image from this java project is using the jib maven plugin | ||
# on the module lsq-pkg-docker-cli: | ||
# mvn clean install | ||
# mvn -pl :lsq-pkg-docker-cli jib:dockerBuild | ||
|
||
# Building this Dockerfile requires buildkit: | ||
# Ensure { "features": { "buildkit": true } } exists in /etc/docker/daemon.json | ||
# (or wherever your deamon.json resides) | ||
|
||
ARG home="/lsq" | ||
|
||
# Final running image | ||
FROM openjdk:11-jre-slim | ||
ARG home | ||
ENV HOME "$home" | ||
# Import the lsq-cli jar from the build step | ||
ADD lsq-pkg-uberjar-cli-*-jar-with-dependencies.jar "$HOME/lsq-cli.jar" | ||
|
||
# Using /data as working directory that will be shared with host for input/output files | ||
WORKDIR /data | ||
VOLUME [ "/data" ] | ||
|
||
# XXX $HOME Does not get expanded in the entry point | ||
ENTRYPOINT ["java","-jar","/lsq/lsq-cli.jar"] | ||
CMD ["-h"] | ||
|
||
# Usage: | ||
# docker run -it -v $(pwd):/data ghcr.io/aksw/lsq rx rdfize --endpoint=http://dbpedia.org/sparql virtuoso.dbpedia.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Helper docker file to build the image from an uberjar and thus avoid a full build. | ||
|
||
For example, this git repository might be checked out on a remote server with only docker available. | ||
In this case, the lsq jar could be built locally and copied to the remote server using `scp`. | ||
|
||
The filename must match the pattern: `lsq-pkg-uberjar-cli-*-jar-with-dependencies.jar` | ||
This is also the file generated when running `make distjar` on the project root. | ||
|
||
Once the uberjar is present, run `docker build .` to build the image. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# In the project root, run "make distjar" to build the uberjar | ||
|
||
cp ../lsq-pkg-parent/lsq-pkg-uberjar-cli/target/lsq-pkg-uberjar-cli-*-jar-with-dependencies.jar . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
lsq-cli/src/main/java/org/aksw/simba/lsq/cli/cmd/base/CmdLsqAnalyzeBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.aksw.simba.lsq.cli.cmd.base; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
import org.aksw.simba.lsq.cli.main.MainCliLsq; | ||
import org.aksw.simba.lsq.enricher.core.LsqEnricherRegistry; | ||
|
||
import picocli.CommandLine.ArgGroup; | ||
import picocli.CommandLine.Option; | ||
import picocli.CommandLine.Parameters; | ||
|
||
public class CmdLsqAnalyzeBase { | ||
@Option(names = { "-h", "--help" }, usageHelp = true) | ||
public boolean help = false; | ||
|
||
@ArgGroup(exclusive = true, multiplicity = "0..1") | ||
public EnricherSpec enricherSpec = new EnricherSpec(); | ||
|
||
public static class EnricherSpec { | ||
@Option(names = { "--only" }, completionCandidates = CompletionCandidatesEnrichers.class) | ||
public List<String> inclusions = null; | ||
|
||
@Option(names = { "--exclude" }, completionCandidates = CompletionCandidatesEnrichers.class) | ||
public List<String> exclusions = null; | ||
|
||
public boolean isWhitelist() { | ||
return inclusions != null; | ||
} | ||
|
||
public List<String> getRawList() { | ||
return inclusions != null | ||
? inclusions | ||
: exclusions != null | ||
? exclusions | ||
: List.of(); | ||
} | ||
|
||
public List<String> getEffectiveList() { | ||
List<String> rawList = getRawList(); | ||
boolean isWhitelist = isWhitelist(); | ||
List<String> result = MainCliLsq.effectiveList(rawList, isWhitelist, new ArrayList<>(LsqEnricherRegistry.get().getKeys())); | ||
return result; | ||
} | ||
} | ||
|
||
public static class CompletionCandidatesEnrichers | ||
implements Iterable<String> { | ||
@Override | ||
public Iterator<String> iterator() { | ||
return LsqEnricherRegistry.get().getKeys().iterator(); | ||
} | ||
} | ||
|
||
@Parameters(arity = "1..*", description = "file-list to probe") | ||
public List<String> nonOptionArgs = new ArrayList<>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.