Skip to content

Commit

Permalink
Merge pull request #204 from sasjonge/fix-metrics
Browse files Browse the repository at this point in the history
Changed to new api of OntoMetrics
  • Loading branch information
daniel86 authored Mar 28, 2022
2 parents a37a40f + 091bc3c commit 1bc1856
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions scripts/OntoMetrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,23 @@ BASEDIR=$(dirname "$0")
# The local OWL file
OWL_FILE="$1"
# The server URL
HOST="https://ontometrics.informatik.uni-rostock.de/ontologymetrics/ServletController"
HOST="http://opi.informatik.uni-rostock.de/api"

echo "${BASEDIR}"

# Prints urldata to stdin
function get_data {
echo -n "text="
php -r "echo rawurlencode(file_get_contents('${1}'));"
echo "&path=&base=on"
}

# the web-service return HTML with a link to XML data
echo "fetching result from https://ontometrics.informatik.uni-rostock.de"
XML_URL=`get_data ${OWL_FILE} | curl ${HOST} \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.5' \
--compressed \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Origin: https://ontometrics.informatik.uni-rostock.de' \
echo "@${OWL_FILE}"
curl ${HOST} \
-H 'Server: Apache/2.4.38 (Debian)' \
-H 'saved: true' \
-H 'Content-Type: application/xml' \
-H 'Vary: Accept-Encoding' \
-H 'Content-Encoding: gzip' \
-H 'Keep-Alive: timeout=5, max=100' \
-H 'Connection: keep-alive' \
-H 'Referer: https://ontometrics.informatik.uni-rostock.de/ontologymetrics/' \
-H 'Upgrade-Insecure-Requests: 1' \
--data "@-" | egrep -o 'https?://[^ ]+\.xml'`
--data "@${OWL_FILE}" > $2/metrics.xml

# download XML data
echo "writing metrics.xml"
curl ${XML_URL} > "$2/metrics.xml"
# convert to JSON
echo "writing metrics.json"
${BASEDIR}/xml2json.py -t xml2json -o "$2/metrics.json" "$2/metrics.xml"
Expand Down

0 comments on commit 1bc1856

Please sign in to comment.