<commit_before>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="<PASSWORD>";

	    public static void setupLogging() {
	        final Logger rootLogger = LogManager.getRootLogger();
	        rootLogger.setLevel(Level.OFF);
	        final ConsoleAppender ca = (ConsoleAppender) rootLogger.getAppender("stdout");
	        ca.setLayout(new PatternLayout("%d{MMM dd yyyy HH:mm:ss} %5p [%t] (%F:%L) - %m%n"));
	        rootLogger.setLevel(Level.INFO);
	        // Filter out noisy messages from the following classes.
	        Logger.getLogger(ClientCnxn.class).setLevel(Level.OFF);
	        Logger.getLogger(MockMongoFactory.class).setLevel(Level.OFF);
	    }

	    public static void main(final String[] args) throws Exception {
	        if (IS_DETAILED_LOGGING_ENABLED) {
	            setupLogging();
	        }
	        final Configuration conf = getConf();
	        conf.setBoolean(ConfigUtils.DISPLAY_QUERY_PLAN, PRINT_QUERIES);

	        SailRepository repository = null;
	        SailRepositoryConnection conn = null;
	        try {
	            log.info("Connecting to Indexing Sail Repository.");
	            final Sail sail = RyaSailFactory.getInstance(conf);
	            repository = new SailRepository(sail);
	            conn = repository.getConnection();

	            
	            final long start = System.currentTimeMillis();

	                testInfer(conn, sail);
	                testPropertyChainInference(conn, sail);<commit_msg>Fixed requested changes to examples, closes #219.<commit_after>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;



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="<PASSWORD>";

	    public static void setupLogging() {
	        final Logger rootLogger = LogManager.getRootLogger();
	        final ConsoleAppender ca = (ConsoleAppender) rootLogger.getAppender("stdout");
	        ca.setLayout(new PatternLayout("%d{MMM dd yyyy HH:mm:ss} %5p [%t] (%F:%L) - %m%n"));
	        rootLogger.setLevel(Level.INFO);
	        // Filter out noisy messages from the following classes.
	        Logger.getLogger(ClientCnxn.class).setLevel(Level.OFF);
	        Logger.getLogger(MockMongoFactory.class).setLevel(Level.OFF);
	    }

	    public static void main(final String[] args) throws Exception {
	        if (IS_DETAILED_LOGGING_ENABLED) {
	            setupLogging();
	        }
	        final Configuration conf = getConf();
	        conf.setBoolean(ConfigUtils.DISPLAY_QUERY_PLAN, PRINT_QUERIES);

	        SailRepository repository = null;
	        SailRepositoryConnection conn = null;
	        try {
	            log.info("Connecting to Indexing Sail Repository.");
	            final Sail sail = RyaSailFactory.getInstance(conf);
	            repository = new SailRepository(sail);
	            conn = repository.getConnection();

	            
	            final long start = System.currentTimeMillis();

	                testInfer(conn, sail);
	                testPropertyChainInference(conn, sail);
{'fraction_non_alphanumeric': 0.091682301438399, 'fraction_numerical': 0.0031269543464665416, 'mean_word_length': 4.089751750477403, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2012193', 'n_tokens_mistral': 2501, 'n_tokens_neox': 2365, 'n_words': 460}