Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update serializer tools #189

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions core/bdo.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ Often the Title Page Title for a publication of a reproduction that includes pre

bdo:Gender
rdfs:subClassOf bdo:Type ;
skos:definition "A category into which humans are divided on the basis of their reproductive functions."@en ;
.

bdo:GeneralNote
Expand Down Expand Up @@ -3485,8 +3486,8 @@ bdo:lineageRef

bdo:lineageType
a
owl:FunctionalProperty ,
owl:ObjectProperty
owl:ObjectProperty ,
owl:FunctionalProperty
;
rdfs:label "lineage type"@en ;
adm:userTooltip "Identifies the type of :Lineage such as empowerment, reading transmission, various sorts of instructions and so on"@en ;
Expand Down Expand Up @@ -3808,8 +3809,8 @@ bdo:personHasConsort

bdo:personName
a
owl:IrreflexiveProperty ,
owl:ObjectProperty
owl:ObjectProperty ,
owl:IrreflexiveProperty
;
rdfs:label "name"@en ;
adm:userTooltip "describe a name for a Person"@en ;
Expand Down
31 changes: 16 additions & 15 deletions tools/serializer/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# pre-commit hook script that activates the Sesame serializer to serialize any OWL files in a standard format just before
# they are committed to the (local) Github repository.
#
# Called by "git commit" with no arguments. This hook can stop the commit when it encounters an error.
# Called by "git commit" with no arguments. This hook will stop the commit when it encounters an error.
#
# To enable this hook, rename this file to "pre-commit" and save it in the directory <your git clone root>/.git/hooks
# To enable this hook, save this file to the directory <your git clone root>/.git/hooks
#

# Customized by the git user
#export JAVA_HOME="/c/Program Files (x86)/Java/jre1.8.0_201"
#export JAVA_HOME="/c/Program Files (x86)/Java/jre1.17.0_201"

#
# Redirect all output generated by this script to stderr.
Expand All @@ -26,13 +26,15 @@ function log_error() {
log "ERROR: $@"
}

log "This is the pre-commit hook"
log "This is the pre-commit hook."

java_exe=""
base_dir=""

function findJava() {

min_java=11

whichJava=""

java_home=""
Expand All @@ -44,8 +46,8 @@ function findJava() {
java_home="${JAVA_HOME}"
fi
if [ "${java_home}" == "" ] ; then
log_error A-$JAVA_HOME
log_error "Please set RDF_TOOLKIT_JAVA_HOME or JAVA_HOME to point to a Java 7 or later installation."
log_error A-$JAVA_HOME
log_error "Please set RDF_TOOLKIT_JAVA_HOME or JAVA_HOME to point to a Java ${min_java} or later installation."
return 1
fi
java_home=${java_home/C:\\/\/c\/}
Expand All @@ -55,8 +57,8 @@ function findJava() {
if [ -x "${java_home}/bin/java" ] ; then
whichJava="${java_home}/bin/java"
else
log_error "Could not find java in your RDF_TOOLKIT_JAVA_HOME or JAVA_HOME: ${java_home}"
log_error "Please set RDF_TOOLKIT_JAVA_HOME or JAVA_HOME to point to a Java 7 or later installation."
log_error "Could not find java in your RDF_TOOLKIT_JAVA_HOME or JAVA_HOME: ${java_home}."
log_error "Please set RDF_TOOLKIT_JAVA_HOME or JAVA_HOME to point to a Java ${min_java} or later installation."
return 1
fi
log "whichJava =" $whichJava
Expand All @@ -69,10 +71,10 @@ function findJava() {
local java_major=$1
local java_minor=$2

if [ \( $java_major -eq 1 -a $java_minor -gt 7 \) -o $java_major -gt 7 ] ; then
if [ $java_major -ge $min_java ] ; then
:
else
log_error "You are using Java $java_major.$java_minor whereas the Sesame serializer requires Java 7 or higher"
log_error "You are using Java $java_major.$java_minor whereas the Sesame serializer requires Java ${min_java} or higher."
return 2
fi

Expand All @@ -83,16 +85,15 @@ function findJava() {

function findSerializerJar() {

if [ "${RDF_TOOLKIT_JAR}" == "" ] ; then
RDF_TOOLKIT_JAR="$PWD/tools/serializer/rdf-toolkit.jar"
fi
# DO NOT MODIFY! Only the version of rdf-toolkit.jar found in ${PWD}/tools/ should be used. Mixing versions may create bogus diffs.
RDF_TOOLKIT_JAR="$PWD/tools/serializer/rdf-toolkit.jar"

if [ -f "${RDF_TOOLKIT_JAR}" ] ; then
log "Found rdf-toolkit: ${RDF_TOOLKIT_JAR}"
return 0
fi

log_error "Could not find the rdf-toolkit JAR, please reinstall. Set RDF_TOOLKIT_JAR or put rdf-toolkit.jar in the .git/hook directory."
log_error "Could not find rdf-toolkit.jar in ${PWD}/tools/rdf-toolkit.jar. Please retrieve the file from the git repository. ONLY this version of the file should be used in order to prevent bogus diffs caused by mixing versions."

return 1
}
Expand Down Expand Up @@ -180,7 +181,7 @@ __log_config__
log "Launching the sesame-serializer with --source ${file}"

set -x
"${java_exe}" -Xmx1g "-Dorg.clapper.avsl.config=${logcfg}" -cp "${RDF_TOOLKIT_JAR}" org.edmcouncil.rdf_toolkit.SesameRdfFormatter \
"${java_exe}" -Xmx1g "-Dorg.clapper.avsl.config=${logcfg}" -jar "${RDF_TOOLKIT_JAR}" \
--source "${file}" \
--target "${file}X" \
--target-format ${tfmt} \
Expand Down
Binary file modified tools/serializer/rdf-toolkit.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions tools/serializer/serialize
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

usage() {
scriptname=`basename "$0"`
echo Serializes RDF files into a standard format. Operates on a single file, all files in a directory, or a set of files specified with a wildcard. Files are assumed to have either .owl or .ttl extension. Assumes rdf-toolkit.jar is in the same directory as this script.
echo Formats RDF files into a standard format. Operates on a single file, all files in a directory, or a set of files specified with a wildcard. Files are assumed to have either .owl or .ttl extension. Assumes rdf-toolkit.jar is in the same directory as this script.
echo Usage: $scriptname [ file \| directory \| wildcard expression ]
echo Examples:
echo $scriptname ./core/bdo.ttl
echo $scriptname ../core
echo "$scriptname ../core/*.ttl"
echo $scriptname ./ontologies/gistCore.ttl
echo $scriptname ../ontologies
echo "$scriptname ../ontologies/*.owl"
}

serialize_file() {
Expand Down