summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorentin Noël <corentin@elementary.io>2018-07-29 01:42:55 +0100
committerCorentin Noël <corentin@elementary.io>2018-07-29 01:42:55 +0100
commit50dee2e79af196e412fe7ee35f641b189d94eefe (patch)
tree6cdf15faa8c20d9b71f0471933da84f96a3f6ab1
parent131a84f1a65a4ce8bffd94f52746425f7e96b7ae (diff)
downloadzeitgeist-tintou/no-rapper.tar.gz
Do not use rappertintou/no-rapper
-rw-r--r--configure.ac6
-rwxr-xr-xdata/ontology2code25
2 files changed, 9 insertions, 22 deletions
diff --git a/configure.ac b/configure.ac
index 9ec5f52c..f8b9b320 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,12 +248,6 @@ fi
# Ontology parsing dependencies
#################################################
-# check for rapper
-AC_CHECK_PROG(HAVE_RAPPER, rapper, yes, no)
-if test "x$HAVE_RAPPER" = "xno"; then
- AC_MSG_ERROR("You need the tool `rapper' from the `raptor-utils' package in order to compile Zeitgeist")
-fi
-
# check for python-rdflib
AC_MSG_CHECKING([for python-rdflib])
echo "import rdflib" | $PYTHON - 2>/dev/null
diff --git a/data/ontology2code b/data/ontology2code
index b8efbfdc..acaf330c 100755
--- a/data/ontology2code
+++ b/data/ontology2code
@@ -192,24 +192,21 @@ class OntologyParser:
symbols = None
def __init__(self, directory):
- rdfxml = self._load_rdfxml_from_trig_directory(directory)
- self.symbols = self._parse(rdfxml)
-
- @staticmethod
- def _load_rdfxml_from_trig_directory(directory):
if not os.path.isdir(directory):
raise SystemExit, 'Directory doesn\'t exist: %s' % directory
- files = ' '.join(glob.glob(os.path.join(directory, '*.trig')))
- return commands.getoutput(
- "cat %s | rapper -i trig -o rdfxml -I ZeitgeistNamespace - " \
- "2>/dev/null" % files)
+ files = glob.glob(os.path.join(directory, '*.trig'))
+ self.symbols = SymbolCollection()
+ for file in files:
+ self._parse(file)
- def _parse(self, rdfxml_stream):
+ self.symbols.post_process()
+
+ def _parse(self, file):
"""
Parse an RDFXML stream into a SymbolCollection.
"""
ontology = rdflib.ConjunctiveGraph()
- ontology.parse(StringInputSource(rdfxml_stream))
+ ontology.parse(file, format="trig")
def _get_all_classes(*super_classes):
for cls in super_classes:
@@ -222,7 +219,6 @@ class OntologyParser:
symbol_classes = set(_get_all_classes(*parent_classes))
all_symbols = symbol_classes.union(parent_classes)
- symbols = SymbolCollection()
for symbol in sorted(all_symbols):
# URI
uri = str(symbol)
@@ -243,10 +239,7 @@ class OntologyParser:
assert parents
# And we have a new Symbol!
- symbols.register(uri, parents, display_name, doc)
-
- symbols.post_process()
- return symbols
+ self.symbols.register(uri, parents, display_name, doc)
class GenericSerializer: