Commit 17070382 authored by Joerg Steffen's avatar Joerg Steffen
Browse files

Merge branch 'developer'

# Conflicts:
#	src/main/java/de/dfki/lt/hfc/Operator.java
#	src/main/java/de/dfki/lt/hfc/OperatorRegistry.java
#	src/main/java/de/dfki/lt/hfc/TIntArrayHashingStrategy.java
parents da0370fd 51c73095
...@@ -13,3 +13,4 @@ hfc.iml ...@@ -13,3 +13,4 @@ hfc.iml
.idea .idea
*~ *~
**/~ **/~
/nbproject/
\ No newline at end of file
\begin{document}
\begin{table}
\begin{verbatim}
<query> ::= <select> <where> [<filter>] [<aggregate>] | ASK <groundtuple>
<select> ::= {"SELECT" | "SELECTALL"} ["DISTINCT"] {"*" | <var>^+}
<var> ::= "?"{a-zA-Z0-9}^+ | "?_"
<nwchar> ::= any NON-whitespace character
<where> ::= "WHERE" <tuple> {"&" <tuple>}^*
<tuple> ::= <literal>^+
<gtuple> ::= <constant>^+
<literal> ::= <var> | <constant>
<constant> ::= <uri> | <atom>
<uri> ::= "<" <nwchar>^+ ">"
<atom> ::= "\"" <char>^* "\"" [ "@" <langtag> | "^^" <xsdtype> ]
<char> ::= any character, incl. whitespaces, numbers, even '\"'
<langtag> ::= "de" | "en" | ...
<xsdtype> ::= "<xsd:int>" | "<xsd:long>" | "<xsd:float>" | "<xsd:double>" | "<xsd:dateTime>" |
"<xsd:string>" | "<xsd:boolean>" | "<xsd:date>" | "<xsd:gYear>" | "<xsd:gMonthDay>" |
"<xsd:gDay>" | "<xsd:gMonth>" | "<xsd:gYearMonth>" | "<xsd:duration>" | "<xsd:anyURI>" | ...
<filter> ::= "FILTER" <constr> {"&" <constr>}^*
<constr> ::= <ineq> | <predcall>
<ineq> ::= <var> "!=" <literal>
<predcall> ::= <predicate> <literal>^*
<predicate> ::= <nwchar>^+
<aggregate> ::= "AGGREGATE" <funcall> {"&" <funcall>}^*
<funcall> ::= <var>^+ "=" <function> <literal>^*
<function> ::= <nwchar>^+
\end{verbatim}
\caption{BNF for the hfc query syntax}
\end{table}
\textbf{Notes:}
\begin{itemize}
\item The reserved keywords ASK, SELECT, SELECTALL, DISTINCT, WHERE, FILTER, and
AGGREGATE need \emph{not} be written uppercase.
\item It is required that neither filter predicates nor aggregate functions have the same name as the above reserved keywords
\item \emph{don't-care} variables should be marked \emph{explicitly} by using
exactly the identifier \texttt{?\_}; this is especially important when using
\texttt{"*"} in a SELECT;
example:
\begin{verbatim}
SELECT DISTINCT WHERE ?s <rdf:type> ?_
SELECT WHERE ?s <rdf:type> ?o ?_ ?_
\end{verbatim}
when restricting the object position without projecting it, we explicitly
write down the selected vars:
\begin{verbatim}
SELECT ?s WHERE ?s <rdf:type> ?o ?_ ?_ FILTER ?o != <foo-class>
\end{verbatim}
\end{itemize}
\end{document}
\ No newline at end of file
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
unless="maven.mode.offline"> unless="maven.mode.offline">
<mkdir dir="${maven.repo.local}"/> <mkdir dir="${maven.repo.local}"/>
<mkdir dir="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-client/3.1.3"/> <mkdir dir="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-client/3.1.3"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//org/apache/xmlrpc/xmlrpc-client/3.1.3/xmlrpc-client-3.1.3.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//org/apache/xmlrpc/xmlrpc-client/3.1.3/xmlrpc-client-3.1.3.jar"
dest="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-client/3.1.3/xmlrpc-client-3.1.3.jar" dest="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-client/3.1.3/xmlrpc-client-3.1.3.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-common/3.1.3"/> <mkdir dir="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-common/3.1.3"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//org/apache/xmlrpc/xmlrpc-common/3.1.3/xmlrpc-common-3.1.3.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//org/apache/xmlrpc/xmlrpc-common/3.1.3/xmlrpc-common-3.1.3.jar"
dest="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-common/3.1.3/xmlrpc-common-3.1.3.jar" dest="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-common/3.1.3/xmlrpc-common-3.1.3.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/apache/ws/commons/util/ws-commons-util/1.0.2"/> <mkdir dir="${maven.repo.local}/org/apache/ws/commons/util/ws-commons-util/1.0.2"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar"
dest="${maven.repo.local}/org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar" dest="${maven.repo.local}/org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/xml-apis/xml-apis/1.0.b2"/> <mkdir dir="${maven.repo.local}/xml-apis/xml-apis/1.0.b2"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"
dest="${maven.repo.local}/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" dest="${maven.repo.local}/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -284,7 +284,7 @@ ...@@ -284,7 +284,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-server/3.1.3"/> <mkdir dir="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-server/3.1.3"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//org/apache/xmlrpc/xmlrpc-server/3.1.3/xmlrpc-server-3.1.3.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//org/apache/xmlrpc/xmlrpc-server/3.1.3/xmlrpc-server-3.1.3.jar"
dest="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-server/3.1.3/xmlrpc-server-3.1.3.jar" dest="${maven.repo.local}/org/apache/xmlrpc/xmlrpc-server/3.1.3/xmlrpc-server-3.1.3.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/commons-logging/commons-logging/1.0.2"/> <mkdir dir="${maven.repo.local}/commons-logging/commons-logging/1.0.2"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar"
dest="${maven.repo.local}/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar" dest="${maven.repo.local}/commons-logging/commons-logging/1.0.2/commons-logging-1.0.2.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -302,7 +302,7 @@ ...@@ -302,7 +302,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/jline/jline/0.9.5"/> <mkdir dir="${maven.repo.local}/jline/jline/0.9.5"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//jline/jline/0.9.5/jline-0.9.5.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//jline/jline/0.9.5/jline-0.9.5.jar"
dest="${maven.repo.local}/jline/jline/0.9.5/jline-0.9.5.jar" dest="${maven.repo.local}/jline/jline/0.9.5/jline-0.9.5.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -311,7 +311,7 @@ ...@@ -311,7 +311,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/net/sf/trove4j/trove4j/3.0.3"/> <mkdir dir="${maven.repo.local}/net/sf/trove4j/trove4j/3.0.3"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar"
dest="${maven.repo.local}/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar" dest="${maven.repo.local}/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/junit/junit/4.12"/> <mkdir dir="${maven.repo.local}/junit/junit/4.12"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//junit/junit/4.12/junit-4.12.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//junit/junit/4.12/junit-4.12.jar"
dest="${maven.repo.local}/junit/junit/4.12/junit-4.12.jar" dest="${maven.repo.local}/junit/junit/4.12/junit-4.12.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
...@@ -329,7 +329,7 @@ ...@@ -329,7 +329,7 @@
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3"/> <mkdir dir="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3"/>
<get src="http://www.bsnsoft.de/nexus/content/groups/public//org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" <get src="http://www.forschungssoftware.de/nexus/content/groups/public//org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
dest="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" dest="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
usetimestamp="false" usetimestamp="false"
ignoreerrors="true"/> ignoreerrors="true"/>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>de.dfki.lt.hfc</groupId> <groupId>de.dfki.lt.hfc</groupId>
<artifactId>hfc</artifactId> <artifactId>hfc</artifactId>
<version>1.1.0-SNAPSHOT</version> <version>1.2.5-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<inceptionYear>2015</inceptionYear> <inceptionYear>2015</inceptionYear>
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
</licenses> </licenses>
<properties> <properties>
<maven.compiler.source>7</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>7</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</properties> </properties>
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
</executions> </executions>
<configuration> <configuration>
<failOnError>false</failOnError> <failOnError>false</failOnError>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration> </configuration>
</plugin> </plugin>
...@@ -99,6 +100,19 @@ ...@@ -99,6 +100,19 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<!-- Make sure all classes are used for tests, not just with 'Test' in name -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<includes>
<include>de/dfki/lt/hfc/**/*.java</include>
</includes>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
...@@ -115,12 +129,6 @@ ...@@ -115,12 +129,6 @@
<version>3.1.3</version> <version>3.1.3</version>
</dependency> </dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.2</version>
</dependency>
<dependency> <dependency>
<groupId>jline</groupId> <groupId>jline</groupId>
<artifactId>jline</artifactId> <artifactId>jline</artifactId>
...@@ -140,27 +148,23 @@ ...@@ -140,27 +148,23 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.19</version>
</dependency>
<repositories> <dependency>
<repository> <groupId>log4j</groupId>
<id>BSNSOFT</id> <artifactId>log4j</artifactId>
<name>BSNSOFT</name> <version>1.2.17</version>
<url>http://www.bsnsoft.de/nexus/content/groups/public/</url> </dependency>
</repository>
</repositories> </dependencies>
<distributionManagement>
<snapshotRepository>
<id>BSNSOFT</id>
<name>BSNSOFT</name>
<url>http://www.bsnsoft.de/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>BSNSOFT</id>
<name>BSNSOFT</name>
<url>http://www.bsnsoft.de/nexus/content/repositories/releases/</url>
</repository>
</distributionManagement>
</project> </project>
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
package de.dfki.lt.hfc; package de.dfki.lt.hfc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
import java.lang.reflect.*; import java.lang.reflect.*;
...@@ -36,7 +39,11 @@ import java.lang.reflect.*; ...@@ -36,7 +39,11 @@ import java.lang.reflect.*;
* @version Thu Jan 14 14:57:24 CET 2010 * @version Thu Jan 14 14:57:24 CET 2010
*/ */
public final class AggregateRegistry { public final class AggregateRegistry {
/**
* A basic LOGGER.
*/
private static final Logger logger = LoggerFactory.getLogger(AggregateRegistry.class);
/** /**
* all (custom) aggregates should be put in package de.dfki.lt.hfc.aggregates * all (custom) aggregates should be put in package de.dfki.lt.hfc.aggregates
*/ */
...@@ -119,9 +126,9 @@ public final class AggregateRegistry { ...@@ -119,9 +126,9 @@ public final class AggregateRegistry {
} }
catch (Exception e) { catch (Exception e) {
if (AggregateRegistry.EXIT_WHEN_REGISTRATION_FAILS) if (AggregateRegistry.EXIT_WHEN_REGISTRATION_FAILS)
System.exit(1); throw new RuntimeException("FATAL ERROR");
else else
System.out.println(" registering aggregate " + className + " fails"); logger.info(" registering aggregate " + className + " fails");
return null; return null;
} }
} }
......
...@@ -473,7 +473,7 @@ public class BindingTable { ...@@ -473,7 +473,7 @@ public class BindingTable {
/** /**
* an implementation of TupleIterator for BindingTable objects * an implementation of TupleIterator for BindingTable objects
*/ */
class BindingTableIterator implements TupleIterator { public class BindingTableIterator implements TupleIterator {
/** /**
* the number of tuples covered by the binding table * the number of tuples covered by the binding table
......
/*
* The Creative Commons CC-BY-NC 4.0 License
*
* http://creativecommons.org/licenses/by-nc/4.0/legalcode
*
* Creative Commons (CC) by DFKI GmbH
* - Hans Ulrich Krieger <krieger@dfki.de>
* - Bernd Kiefer <kiefer@dfki.de>
* - Christian Willms <christian.willms@dfki.de>
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
package de.dfki.lt.hfc;
/**
* FunctionalOperator (FO for short) is assumed to be the abstract superclass of all
* functional operators (functions and predicates) used in the forward chainer;
* every subclass of FunctionalOperator MUST implement exactly one unary method,
* called apply(int[] args), together with a package specification and (at least)
* one import statement:
*
* // put your FO in _this_ package:
* package de.dfki.lt.hfc.operators;
*
* // give access to methods from FunctionalOperator which safely access the tuple
* // store via class Operator
* import de.dfki.lt.hfc.FunctionalOperator;
*
* // put your code for the FO in here with exactly the same signature
* public int apply(int[] args) {
* ...
* }
*
* the args (an int array) given to apply() are exactly the arguments given to the FO
* specified in the rules of the forward chainer;
* the return value is usually a positive int, encoding the the application of the FO
* to its arguments;
*
* note that we reserve 0, -1, and -2 as special return values:
* @see FunctionalOperator.UNBOUND
* @see FunctionalOperator.TRUE
* @see FunctionalOperator.FALSE
* @see FunctionalOperator.DONT_KNOW
*
* even a prdicate must return a value (either FunctionalOperator.TRUE or FunctionalOperator.FALSE),
* that is why a predicate is subsumed by the term _Functional_Operator
*
* NOTE: a functional operator is required _not_ to implement any constructor;
*
* @see Operator for the abstract superclass providing useful implemented methods
* @see de.dfki.lt.hfc.Operator for a description of _relational_ operators
*
* @see de.dfki.lt.hfc.operators.NoValue for an example (predicate)
* @see de.dfki.lt.hfc.operators.Concatenate for an example (function)
*
* @author (C) Hans-Ulrich Krieger
* @since JDK 1.5
* @version Fri Mar 8 12:36:22 CET 2013
*/
public abstract class BooleanOperator extends FunctionalOperator {
public int apply(int[] args) { return holds(args) ? TRUE : FALSE; }
/**
* !!! this is the one and only method that you MUST implement !!!
*/
protected abstract boolean holds(int[] args);
}
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
package de.dfki.lt.hfc; package de.dfki.lt.hfc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
...@@ -126,6 +129,11 @@ public class Configuration { ...@@ -126,6 +129,11 @@ public class Configuration {
private HashSet<String> files = new HashSet<String>(); private HashSet<String> files = new HashSet<String>();
/**
* A basic LOGGER.
*/
private static final Logger logger = LoggerFactory.getLogger(Configuration.class);
/** /**
* the unary constructor takes a config file as explained above * the unary constructor takes a config file as explained above
*/ */
...@@ -142,10 +150,11 @@ public class Configuration { ...@@ -142,10 +150,11 @@ public class Configuration {
st = new StringTokenizer(line, " =:\t"); st = new StringTokenizer(line, " =:\t");
processSpecification(st); processSpecification(st);
} }
br.close();
} }
catch (Exception e) { catch (Exception e) {
System.err.println("\nerror while reading configuration file " + configFile); logger.error("\nerror while reading configuration file " + configFile);
System.exit(1); throw new RuntimeException("FATAL ERROR");
} }
} }
...@@ -197,7 +206,7 @@ public class Configuration { ...@@ -197,7 +206,7 @@ public class Configuration {
private void processNames(String namespaceFile) private void processNames(String namespaceFile)
throws FileNotFoundException, WrongFormatException, IOException { throws FileNotFoundException, WrongFormatException, IOException {
if (this.files.contains(namespaceFile)) { if (this.files.contains(namespaceFile)) {
System.out.println(namespaceFile + " used twice"); logger.info(namespaceFile + " used twice");
return; return;
} }
if (this.namespace == null) if (this.namespace == null)
...@@ -214,7 +223,7 @@ public class Configuration { ...@@ -214,7 +223,7 @@ public class Configuration {
*/ */
private void processTuples(String tupleFile) throws FileNotFoundException, IOException, WrongFormatException { private void processTuples(String tupleFile) throws FileNotFoundException, IOException, WrongFormatException {
if (this.files.contains(tupleFile)) { if (this.files.contains(tupleFile)) {
System.out.println(tupleFile + " used twice"); logger.info(tupleFile + " used twice");
return; return;
} }
if (this.tupleStore == null) { if (this.tupleStore == null) {
...@@ -234,7 +243,7 @@ public class Configuration { ...@@ -234,7 +243,7 @@ public class Configuration {
*/ */
private void processRules(String ruleFile) throws IOException { private void processRules(String ruleFile) throws IOException {
if (this.files.contains(ruleFile)) { if (this.files.contains(ruleFile)) {
System.out.println(ruleFile + " used twice"); logger.info(ruleFile + " used twice");
return; return;
} }
if (this.ruleStore == null) { if (this.ruleStore == null) {
......
...@@ -22,8 +22,11 @@ package de.dfki.lt.hfc; ...@@ -22,8 +22,11 @@ package de.dfki.lt.hfc;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import de.dfki.lt.hfc.indices.IndexingException;
import gnu.trove.set.hash.*; import gnu.trove.set.hash.*;
import gnu.trove.map.hash.*; import gnu.trove.map.hash.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* generates a tuple store, a rule store, and a namespace object in order to * generates a tuple store, a rule store, and a namespace object in order to
...@@ -44,6 +47,11 @@ import gnu.trove.map.hash.*; ...@@ -44,6 +47,11 @@ import gnu.trove.map.hash.*;
*/ */
public final class ForwardChainer { public final class ForwardChainer {
/**
* A basic LOGGER.
*/
private static final Logger logger = LoggerFactory.getLogger(ForwardChainer.class);
/**q /**q
* HFC version number string * HFC version number string
*/ */
...@@ -118,7 +126,7 @@ public final class ForwardChainer { ...@@ -118,7 +126,7 @@ public final class ForwardChainer {
* a similar variable exists in class RuleStore * a similar variable exists in class RuleStore
* @see #exitOnError * @see #exitOnError
*/ */
public boolean verbose = true; public boolean verbose = false;
/** /**
* a constant that controls whether the system is terminated in case an invalid * a constant that controls whether the system is terminated in case an invalid
...@@ -173,11 +181,11 @@ public final class ForwardChainer { ...@@ -173,11 +181,11 @@ public final class ForwardChainer {
*/ */
private void init() { private void init() {
if (this.verbose) { if (this.verbose) {
System.out.println(); //System.out.println();
System.out.println(" Welcome to HFC, HUK's Forward Chainer"); logger.info(" Welcome to HFC, HUK's Forward Chainer");
System.out.println(" " + ForwardChainer.INFO); logger.info(" " + ForwardChainer.INFO);
System.out.println(" # CPU cores: " + this.noOfCores); logger.info(" # CPU cores: " + this.noOfCores);
System.out.println(" " + this.toString()); logger.info(" " + this.toString());
} }
}