@Test public void testPreprocessRdfData() { InputStream[] datasets = new InputStream[] { PostgresKB.class.getResourceAsStream("test1.ttl"), PostgresKB.class.getResourceAsStream("test2.ttl") }; try { kb.preprocessRdfData(datasets, MediaType.TURTLE, MediaType.TEXT, "http: Connection conn = pool.getConnection(); ResultSet rs = conn.createStatement().executeQuery( "SELECT uri FROM index_resources"); while (rs.next()) { String uriFromDB = rs.getString(1); int key = kb.getUriIndex(uriFromDB); String uriFromKB = kb.getURI(key); assertEquals(uriFromDB, uriFromKB); } rs.close(); rs = conn.createStatement().executeQuery( "SELECT literal FROM index_literals"); while (rs.next()) { String literalFromDB = rs.getString(1); int key = kb.getLiteralIndex(literalFromDB); String literalFromKB = kb.getLiteral(key); assertEquals(literalFromDB, literalFromKB); } rs.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
@Override public void preprocessRdfData(InputStream[] datasets, MediaType rdfMimeType, MediaType fileMimeType, String absoluteBaseURI, LiteralHashing hashing) throws Exception { this.connection.setAutoCommit(false); createDatabase(); loadRDFData(datasets, rdfMimeType, absoluteBaseURI, fileMimeType, hashing); connection.commit(); createIndexes(); connection.commit(); }
PostgresKB implements KnowledgeBase { @Override public void preprocessRdfData(InputStream[] datasets, MediaType rdfMimeType, MediaType fileMimeType, String absoluteBaseURI, LiteralHashing hashing) throws Exception { this.connection.setAutoCommit(false); createDatabase(); loadRDFData(datasets, rdfMimeType, absoluteBaseURI, fileMimeType, hashing); connection.commit(); createIndexes(); connection.commit(); } }
PostgresKB implements KnowledgeBase { @Override public void preprocessRdfData(InputStream[] datasets, MediaType rdfMimeType, MediaType fileMimeType, String absoluteBaseURI, LiteralHashing hashing) throws Exception { this.connection.setAutoCommit(false); createDatabase(); loadRDFData(datasets, rdfMimeType, absoluteBaseURI, fileMimeType, hashing); connection.commit(); createIndexes(); connection.commit(); } PostgresKB(Connection connection, String session, URI uri); protected  PostgresKB(Connection connection, String session, URI uri, String dbSchema, String indexSchema); }
PostgresKB implements KnowledgeBase { @Override public void preprocessRdfData(InputStream[] datasets, MediaType rdfMimeType, MediaType fileMimeType, String absoluteBaseURI, LiteralHashing hashing) throws Exception { this.connection.setAutoCommit(false); createDatabase(); loadRDFData(datasets, rdfMimeType, absoluteBaseURI, fileMimeType, hashing); connection.commit(); createIndexes(); connection.commit(); } PostgresKB(Connection connection, String session, URI uri); protected  PostgresKB(Connection connection, String session, URI uri, String dbSchema, String indexSchema); @Override URI getUri(); @Override ResultSetCursor getDatatypePropertyValues(
			int[] datatypePropertyFilter, SuffixArray suffixArray); @Override ResultSetCursor getInstanceCandidates(
			Map<Integer, Set<Integer>> literalKeys); @Override ResultSetCursor dbSort(List<String> index, int maxLength); @Override int getLiteralIndex(String literal); @Override String getURI(int index); @Override String getLiteral(int index); @Override int getUriIndex(String uri); @Override ResultSetCursor getOutgoingRelations(int[] instances); @Override ResultSetCursor getIncomingRelations(int[] instances); @Override ResultSetCursor getRDFTypesForInstances(int[] subjects); @Override ResultSetCursor getInstancesOfTypes(int type, int count); @Override ResultSetCursor getRDFTypes(); @Override int[] getClusters(); @Override int[] getDatatypePropertyByClass(int cluster, double t); @Override Collection<int[]> getConnectingClusters(int objectProperty, double t); @Override int getCluster(int[] types); @Override int getPropertyType(int property); @Override void preprocessRdfData(InputStream[] datasets,
			MediaType rdfMimeType, MediaType fileMimeType,
			String absoluteBaseURI, LiteralHashing hashing); @Override void calculateCardinalities(); @Override double getSubjectCardinality(int p); @Override void calculateMarkovChain(int[] blackListedProperties,
			int sampleCount); @Override double getMarkovProbability(int subject, int predicate, int object); @Override List<double[]> getMaxMarkovProbability(int subject, int object, int k); @Override TIntObjectHashMap<TIntObjectHashMap<double[]>> getCoverageAmbiguity(); @Override void calculateProperNameStatistics(TextCorpus corpus, Pipeline pipe); @Override DoubleMatrix getTypeCorrelations(int samples); @Override void clusterCorrelatingClasses(int samples, double biasThreshold,
			double pruningThreshold); @Override void calculateRegexDistributions(String[] regexs); @Override TIntDoubleHashMap getDatatypePropertiesForRegex(String regex); @Override String[] getRegexs(); }
PostgresKB implements KnowledgeBase { @Override public void preprocessRdfData(InputStream[] datasets, MediaType rdfMimeType, MediaType fileMimeType, String absoluteBaseURI, LiteralHashing hashing) throws Exception { this.connection.setAutoCommit(false); createDatabase(); loadRDFData(datasets, rdfMimeType, absoluteBaseURI, fileMimeType, hashing); connection.commit(); createIndexes(); connection.commit(); } PostgresKB(Connection connection, String session, URI uri); protected  PostgresKB(Connection connection, String session, URI uri, String dbSchema, String indexSchema); @Override URI getUri(); @Override ResultSetCursor getDatatypePropertyValues(
			int[] datatypePropertyFilter, SuffixArray suffixArray); @Override ResultSetCursor getInstanceCandidates(
			Map<Integer, Set<Integer>> literalKeys); @Override ResultSetCursor dbSort(List<String> index, int maxLength); @Override int getLiteralIndex(String literal); @Override String getURI(int index); @Override String getLiteral(int index); @Override int getUriIndex(String uri); @Override ResultSetCursor getOutgoingRelations(int[] instances); @Override ResultSetCursor getIncomingRelations(int[] instances); @Override ResultSetCursor getRDFTypesForInstances(int[] subjects); @Override ResultSetCursor getInstancesOfTypes(int type, int count); @Override ResultSetCursor getRDFTypes(); @Override int[] getClusters(); @Override int[] getDatatypePropertyByClass(int cluster, double t); @Override Collection<int[]> getConnectingClusters(int objectProperty, double t); @Override int getCluster(int[] types); @Override int getPropertyType(int property); @Override void preprocessRdfData(InputStream[] datasets,
			MediaType rdfMimeType, MediaType fileMimeType,
			String absoluteBaseURI, LiteralHashing hashing); @Override void calculateCardinalities(); @Override double getSubjectCardinality(int p); @Override void calculateMarkovChain(int[] blackListedProperties,
			int sampleCount); @Override double getMarkovProbability(int subject, int predicate, int object); @Override List<double[]> getMaxMarkovProbability(int subject, int object, int k); @Override TIntObjectHashMap<TIntObjectHashMap<double[]>> getCoverageAmbiguity(); @Override void calculateProperNameStatistics(TextCorpus corpus, Pipeline pipe); @Override DoubleMatrix getTypeCorrelations(int samples); @Override void clusterCorrelatingClasses(int samples, double biasThreshold,
			double pruningThreshold); @Override void calculateRegexDistributions(String[] regexs); @Override TIntDoubleHashMap getDatatypePropertiesForRegex(String regex); @Override String[] getRegexs();  }