You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@rya.apache.org by amihalik <gi...@git.apache.org> on 2017/09/07 15:14:27 UTC
[GitHub] incubator-rya pull request #219: Creating inference Examples
Github user amihalik commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/219#discussion_r137566563
--- Diff: extras/indexingExample/src/main/java/InferenceExamples.java ---
@@ -0,0 +1,592 @@
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.commons.lang.Validate;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.apache.rya.indexing.accumulo.ConfigUtils;
+import org.apache.rya.indexing.mongodb.MongoIndexingConfiguration;
+import org.apache.rya.indexing.mongodb.MongoIndexingConfiguration.MongoDBIndexingConfigBuilder;
+import org.apache.rya.mongodb.MockMongoFactory;
+import org.apache.rya.mongodb.MongoConnectorFactory;
+import org.apache.rya.rdftriplestore.RdfCloudTripleStore;
+import org.apache.rya.rdftriplestore.inference.InferenceEngineException;
+import org.apache.rya.sail.config.RyaSailFactory;
+import org.apache.zookeeper.ClientCnxn;
+import org.openrdf.model.Namespace;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.vocabulary.OWL;
+import org.openrdf.model.vocabulary.RDF;
+import org.openrdf.model.vocabulary.RDFS;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.MalformedQueryException;
+import org.openrdf.query.QueryEvaluationException;
+import org.openrdf.query.QueryLanguage;
+import org.openrdf.query.QueryResultHandlerException;
+import org.openrdf.query.TupleQuery;
+import org.openrdf.query.TupleQueryResultHandler;
+import org.openrdf.query.TupleQueryResultHandlerException;
+import org.openrdf.query.Update;
+import org.openrdf.query.UpdateExecutionException;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.repository.RepositoryResult;
+import org.openrdf.repository.sail.SailRepository;
+import org.openrdf.repository.sail.SailRepositoryConnection;
+import org.openrdf.sail.Sail;
+
+import com.mongodb.MongoClient;
+import com.mongodb.ServerAddress;
+
+
+//
+//See notes in inferenceExamples_readme.txt
+//
+
+public class InferenceExamples {
+ private static final Logger log = Logger.getLogger(InferenceExamples.class);
+
+ private static final boolean IS_DETAILED_LOGGING_ENABLED = false;
+
+ //
+ // Connection configuration parameters
+ //
+
+ private static final boolean PRINT_QUERIES = true;
+ private static final String MONGO_DB = "rya";
+ private static final String MONGO_COLL_PREFIX = "rya_";
+ private static final boolean USE_EMBEDDED_MONGO = true;
+ private static final String MONGO_INSTANCE_URL = "localhost";
+ private static final String MONGO_INSTANCE_PORT = "27017";
+ private static final String MongoUserName="usern";
+ private static final String MongoUserPassword="passwd";
+
+ public static void setupLogging() {
+ final Logger rootLogger = LogManager.getRootLogger();
+ rootLogger.setLevel(Level.OFF);
+ final ConsoleAppender ca = (ConsoleAppender) rootLogger.getAppender("stdout");
--- End diff --
Do you still need this if you've created the config file?
---