From 4950c9a78eda022c5342efbc77eb1135881f11ac Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Sun, 6 Dec 2020 09:50:47 +0000 Subject: Add method to retrieve diagnostics from RDFox --- src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') 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 193119f..9dd52cf 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 @@ -3,6 +3,7 @@ package uk.ac.ox.cs.rsacomb.util import java.io.StringReader import tech.oxfordsemantic.jrdfox.Prefixes import tech.oxfordsemantic.jrdfox.client.{ + ComponentInfo, ConnectionFactory, ServerConnection, DataStoreConnection, @@ -66,6 +67,20 @@ object RDFoxUtil { (server, data) } + /** Gather statistics from RDFox datastore. + * + * @see [[https://docs.oxfordsemantic.tech/programmatic-access-APIs.html#in-depth-diagnostic-information]] + * and [[https://docs.oxfordsemantic.tech/programmatic-access-APIs.html#managing-statistics]] + * for more ways of gathering diagnostics from RDFox. + */ + def gatherStatistics(data: DataStoreConnection): String = { + val info = data.getComponentInfo(true) + s"${info.getName}: ${info.getPropertyValues}" + .replaceAll("\\{", "{\n ") + .replaceAll(", ", ",\n ") + .replaceAll("\\}", "\n}") + } + /** Adds a collection of rules to a data store. * * @param data datastore connection -- cgit v1.2.3