From 26f01c74b83cf79f5af425692421380dd3eb6bea Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Sat, 30 Jan 2021 11:01:05 +0000 Subject: Fix facts/rules import into RDFox --- .../scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src/main/scala') diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala index 61a8b79..6833640 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala @@ -105,8 +105,16 @@ object RDFoxUtil { */ def addRules(data: DataStoreConnection, rules: Seq[Rule]): Unit = Logger.timed( - data addRules rules, - "Loading rules", + if (rules.length > 0) { + data.importData( + UpdateType.ADDITION, + RSA.Prefixes, + rules + .map(_.toString(Prefixes.s_emptyPrefixes)) + .mkString("\n") + ) + }, + s"Loading ${rules.length} rules", Logger.DEBUG ) @@ -117,12 +125,18 @@ object RDFoxUtil { */ def addFacts(data: DataStoreConnection, facts: Seq[TupleTableAtom]): Unit = Logger.timed( - data.importData( - UpdateType.ADDITION, - RSA.Prefixes, - facts.map(_.toString(Prefixes.s_emptyPrefixes)).mkString("", ".\n", ".") - ), - "Loading facts", + if (facts.length > 0) { + data.importData( + UpdateType.ADDITION, + RSA.Prefixes, + facts + .map(_.toString(Prefixes.s_emptyPrefixes)) + .mkString("", ".\n", ".") + ) + }, + s"Loading ${facts.length} facts", + Logger.DEBUG + ) /** Imports a sequence of files directly into a datastore. * -- cgit v1.2.3