summaryrefslogtreecommitdiffstats
path: root/scripts/rdfcompare
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:40:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:40:05 +0000
commit4038ab95a094b363f1748f3dcb51511a1217475d (patch)
tree7f393d66a783f91ddd263c78d681e485cf4f45ca /scripts/rdfcompare
parentInitial commit. (diff)
downloadraptor2-4038ab95a094b363f1748f3dcb51511a1217475d.tar.xz
raptor2-4038ab95a094b363f1748f3dcb51511a1217475d.zip
Adding upstream version 2.0.16.upstream/2.0.16upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xscripts/rdfcompare55
1 files changed, 55 insertions, 0 deletions
diff --git a/scripts/rdfcompare b/scripts/rdfcompare
new file mode 100755
index 0000000..6430bf4
--- /dev/null
+++ b/scripts/rdfcompare
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Compare two RDF graphs
+#
+# Needs an external utility to do a true graph compare.
+#
+
+
+PROGRAM=`basename $0`
+
+CMP=cmp
+DIFF=diff
+
+tmpdiff=/tmp/rdfcompare$$
+
+if [ $# -lt 1 ] ; then
+ echo "$PROGRAM: compare two RDF graphs for isomorphism" 1>&2
+ echo "USAGE: $PROGRAM RDF-FILE-1 RDF-FILE-2" 1>&2
+ echo "where both files are RDF graphs serialized as N-Triples" 1>&2
+ exit 0
+fi
+
+# Try a simple compare first
+$CMP $1 $2 2>&1
+status=$?
+if test $status -eq 0; then
+ exit 0
+fi
+
+echo "$program: Doing an RDF graph compare" 1>&2
+
+if test "X$NTC" != X; then
+ $NTC $1 $2 > $tmpdiff 2>&1
+ status=$?
+ if test $status != 0; then
+ $DIFF -u $1 $2
+ fi
+elif test "X$JENAROOT" != X; then
+ RDFCOMPARE="$JENAROOT/bin/rdfcompare"
+
+ $RDFCOMPARE $1 $2 N-TRIPLE N-TRIPLE
+ status=$?
+ if test $status != 0; then
+ $DIFF -u $1 $2
+ fi
+else
+ $DIFF -u $1 $2 > $tmpdiff
+ status=$?
+ if test $status != 0; then
+ cat $tmpdiff
+ rm $tmpdiff
+ fi
+fi
+
+exit $status