Skip to content

Commit

Permalink
Fixed Linux line endings, switched from JENAROOT to SHACLROOT
Browse files Browse the repository at this point in the history
  • Loading branch information
HolgerKnublauch committed Jul 4, 2017
1 parent 6c7f621 commit 6703a39
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 50 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Contact: Holger Knublauch ([email protected])

Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application.
This API also serves as a reference implementation developed in parallel to the SHACL spec.
**The code is totally not optimized for performance, just for correctness. And there are unfinished gaps!**
**The code is totally not optimized for performance, just for correctness.**

Coverage:
* SHACL Core and SHACL-SPARQL validation
Expand Down Expand Up @@ -36,9 +36,9 @@ To use them, set up your environment similar to https://jena.apache.org/document

For example, on Windows:

SET JENAROOT=C:\Users\Holger\Desktop\shacl-1.0.0-bin
SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.0.0-bin

SET PATH=%PATH%;%JENAROOT%\bin
SET PATH=%PATH%;%SHACLROOT%\bin

Both tools take the following parameters, for example:

Expand All @@ -49,4 +49,4 @@ whereby -shapesfile is optional and falls back to using the data graph as shapes
Currently only Turtle (.ttl) files are supported.

The tools print the validation report or the inferences graph to the output screen.
The output of the command line utilities is not limited by the SHACL license.
The output of the command line utilities is not limited by the license of the SHACL API.
File renamed without changes.
17 changes: 15 additions & 2 deletions src/assembly/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,31 @@
</dependencySet>
</dependencySets>
<fileSets>

<fileSet>
<directory>src/main/command</directory>
<lineEnding>unix</lineEnding>
<outputDirectory>bin</outputDirectory>
<includes>
<include>*</include>
<include>*.sh</include>
</includes>
</fileSet>

<fileSet>
<directory>src/main/command</directory>
<lineEnding>dos</lineEnding>
<outputDirectory>bin</outputDirectory>
<includes>
<include>*.bat</include>
</includes>
</fileSet>

<fileSet>
<outputDirectory>/</outputDirectory>
<includes>
<include>jena-log4j.properties</include>
<include>log4j.properties</include>
<include>LICENSE</include>
<include>README.md</include>
</includes>
<fileMode>0644</fileMode>
</fileSet>
Expand Down
14 changes: 7 additions & 7 deletions src/main/command/shaclinfer.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
if "%SHACLROOT%" == "" goto :rootNotSet
set SHACL_HOME=%SHACLROOT%
:rootNotSet

if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
if NOT "%SHACL_HOME%" == "" goto :okHome
echo SHACL_HOME not set
exit /B

:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
set SHACL_CP=%SHACL_HOME%\lib\*;
set LOGGING=file:%SHACL_HOME%/log4j.properties

@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" org.topbraid.shacl.tools.Infer %*
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%SHACL_CP%" org.topbraid.shacl.tools.Infer %*
exit /B
30 changes: 15 additions & 15 deletions src/main/command/shaclinfer → src/main/command/shaclinfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ resolveLink() {
echo "$NAME"
}

# If JENA_HOME is empty
if [ -z "$JENA_HOME" ]; then
# If SHACL_HOME is empty
if [ -z "$SHACL_HOME" ]; then
SCRIPT="$0"
# Catch common issue: script has been symlinked
if [ -L "$SCRIPT" ]; then
Expand All @@ -43,37 +43,37 @@ if [ -z "$JENA_HOME" ]; then
fi

# Work out root from script location
JENA_HOME="$( cd "$( dirname "$SCRIPT" )/.." && pwd )"
export JENA_HOME
SHACL_HOME="$( cd "$( dirname "$SCRIPT" )/.." && pwd )"
export SHACL_HOME
fi

# If JENA_HOME is a symbolic link need to resolve
if [ -L "${JENA_HOME}" ]; then
JENA_HOME=$(resolveLink "$JENA_HOME")
# If SHACL_HOME is a symbolic link need to resolve
if [ -L "${SHACL_HOME}" ]; then
SHACL_HOME=$(resolveLink "$SHACL_HOME")
# If link is relative
case "$JENA_HOME" in
case "$SHACL_HOME" in
/*)
# Already absolute
;;
*)
# Relative, make absolute
JENA_HOME=$(dirname "$JENA_HOME")
SHACL_HOME=$(dirname "$SHACL_HOME")
;;
esac
export JENA_HOME
export SHACL_HOME
fi

# ---- Setup
# JVM_ARGS : don't set here but it can be set in the environment.
# Expand JENA_HOME but literal *
JENA_CP="$JENA_HOME"'/lib/*'
# Expand SHACL_HOME but literal *
SHACL_CP="$SHACL_HOME"'/lib/*'
SOCKS=
LOGGING="${LOGGING:--Dlog4j.configuration=file:$JENA_HOME/jena-log4j.properties}"
LOGGING="${LOGGING:--Dlog4j.configuration=file:$SHACL_HOME/log4j.properties}"

# Platform specific fixup
# On CYGWIN convert path and end with a ';'
case "$(uname)" in
CYGWIN*) JENA_CP="$(cygpath -wp "$JENA_CP");";;
CYGWIN*) SHACL_CP="$(cygpath -wp "$SHACL_CP");";;
esac

# Respect TMPDIR or TMP (windows?) if present
Expand All @@ -86,4 +86,4 @@ elif [ -n "$TMP" ]
JVM_ARGS="$JVM_ARGS -Djava.io.tmpdir=\"$TMP\""
fi

java $JVM_ARGS $LOGGING -cp "$JENA_CP" org.topbraid.shacl.tools.Infer "$@"
java $JVM_ARGS $LOGGING -cp "$SHACL_CP" org.topbraid.shacl.tools.Infer "$@"
14 changes: 7 additions & 7 deletions src/main/command/shaclvalidate.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
if "%SHACLROOT%" == "" goto :rootNotSet
set SHACL_HOME=%SHACLROOT%
:rootNotSet

if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
if NOT "%SHACL_HOME%" == "" goto :okHome
echo SHACL_HOME not set
exit /B

:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
set SHACL_CP=%SHACL_HOME%\lib\*;
set LOGGING=file:%SHACL_HOME%/log4j.properties

@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" org.topbraid.shacl.tools.Validate %*
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%SHACL_CP%" org.topbraid.shacl.tools.Validate %*
exit /B
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ resolveLink() {
echo "$NAME"
}

# If JENA_HOME is empty
if [ -z "$JENA_HOME" ]; then
# If SHACL_HOME is empty
if [ -z "$SHACL_HOME" ]; then
SCRIPT="$0"
# Catch common issue: script has been symlinked
if [ -L "$SCRIPT" ]; then
Expand All @@ -43,37 +43,37 @@ if [ -z "$JENA_HOME" ]; then
fi

# Work out root from script location
JENA_HOME="$( cd "$( dirname "$SCRIPT" )/.." && pwd )"
export JENA_HOME
SHACL_HOME="$( cd "$( dirname "$SCRIPT" )/.." && pwd )"
export SHACL_HOME
fi

# If JENA_HOME is a symbolic link need to resolve
if [ -L "${JENA_HOME}" ]; then
JENA_HOME=$(resolveLink "$JENA_HOME")
# If SHACL_HOME is a symbolic link need to resolve
if [ -L "${SHACL_HOME}" ]; then
SHACL_HOME=$(resolveLink "$SHACL_HOME")
# If link is relative
case "$JENA_HOME" in
case "$SHACL_HOME" in
/*)
# Already absolute
;;
*)
# Relative, make absolute
JENA_HOME=$(dirname "$JENA_HOME")
SHACL_HOME=$(dirname "$SHACL_HOME")
;;
esac
export JENA_HOME
export SHACL_HOME
fi

# ---- Setup
# JVM_ARGS : don't set here but it can be set in the environment.
# Expand JENA_HOME but literal *
JENA_CP="$JENA_HOME"'/lib/*'
# Expand SHACL_HOME but literal *
SHACL_CP="$SHACL_HOME"'/lib/*'
SOCKS=
LOGGING="${LOGGING:--Dlog4j.configuration=file:$JENA_HOME/jena-log4j.properties}"
LOGGING="${LOGGING:--Dlog4j.configuration=file:$SHACL_HOME/log4j.properties}"

# Platform specific fixup
# On CYGWIN convert path and end with a ';'
case "$(uname)" in
CYGWIN*) JENA_CP="$(cygpath -wp "$JENA_CP");";;
CYGWIN*) SHACL_CP="$(cygpath -wp "$SHACL_CP");";;
esac

# Respect TMPDIR or TMP (windows?) if present
Expand All @@ -86,4 +86,4 @@ elif [ -n "$TMP" ]
JVM_ARGS="$JVM_ARGS -Djava.io.tmpdir=\"$TMP\""
fi

java $JVM_ARGS $LOGGING -cp "$JENA_CP" org.topbraid.shacl.tools.Validate "$@"
java $JVM_ARGS $LOGGING -cp "$SHACL_CP" org.topbraid.shacl.tools.Validate "$@"

0 comments on commit 6703a39

Please sign in to comment.