diff options
author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2021-01-30 11:01:05 +0000 |
---|---|---|
committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2021-01-30 11:01:05 +0000 |
commit | 26f01c74b83cf79f5af425692421380dd3eb6bea (patch) | |
tree | c3213d45f2f897e12696ed79711003cafe77d19a | |
parent | 7d6021c6c706c108b5b11d52071acd104c7d4ff8 (diff) | |
download | RSAComb-26f01c74b83cf79f5af425692421380dd3eb6bea.tar.gz RSAComb-26f01c74b83cf79f5af425692421380dd3eb6bea.zip |
Fix facts/rules import into RDFox
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala | 30 |
1 files changed, 22 insertions, 8 deletions
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 { | |||
105 | */ | 105 | */ |
106 | def addRules(data: DataStoreConnection, rules: Seq[Rule]): Unit = | 106 | def addRules(data: DataStoreConnection, rules: Seq[Rule]): Unit = |
107 | Logger.timed( | 107 | Logger.timed( |
108 | data addRules rules, | 108 | if (rules.length > 0) { |
109 | "Loading rules", | 109 | data.importData( |
110 | UpdateType.ADDITION, | ||
111 | RSA.Prefixes, | ||
112 | rules | ||
113 | .map(_.toString(Prefixes.s_emptyPrefixes)) | ||
114 | .mkString("\n") | ||
115 | ) | ||
116 | }, | ||
117 | s"Loading ${rules.length} rules", | ||
110 | Logger.DEBUG | 118 | Logger.DEBUG |
111 | ) | 119 | ) |
112 | 120 | ||
@@ -117,12 +125,18 @@ object RDFoxUtil { | |||
117 | */ | 125 | */ |
118 | def addFacts(data: DataStoreConnection, facts: Seq[TupleTableAtom]): Unit = | 126 | def addFacts(data: DataStoreConnection, facts: Seq[TupleTableAtom]): Unit = |
119 | Logger.timed( | 127 | Logger.timed( |
120 | data.importData( | 128 | if (facts.length > 0) { |
121 | UpdateType.ADDITION, | 129 | data.importData( |
122 | RSA.Prefixes, | 130 | UpdateType.ADDITION, |
123 | facts.map(_.toString(Prefixes.s_emptyPrefixes)).mkString("", ".\n", ".") | 131 | RSA.Prefixes, |
124 | ), | 132 | facts |
125 | "Loading facts", | 133 | .map(_.toString(Prefixes.s_emptyPrefixes)) |
134 | .mkString("", ".\n", ".") | ||
135 | ) | ||
136 | }, | ||
137 | s"Loading ${facts.length} facts", | ||
138 | Logger.DEBUG | ||
139 | ) | ||
126 | 140 | ||
127 | /** Imports a sequence of files directly into a datastore. | 141 | /** Imports a sequence of files directly into a datastore. |
128 | * | 142 | * |