com.bigdata.rdf.sail.BigdataSail Java Examples
The following examples show how to use
com.bigdata.rdf.sail.BigdataSail.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestMillisecondPrecisionForInlineDateTimes.java From database with GNU General Public License v2.0 | 6 votes |
/** * Please set your database properties here, except for your journal file, * please DO NOT SPECIFY A JOURNAL FILE. */ @Override public Properties getProperties() { final Properties props = super.getProperties(); /* * For example, here is a set of five properties that turns off * inference, truth maintenance, and the free text index. */ props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName()); props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, NoVocabulary.class.getName()); props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); props.setProperty(BigdataSail.Options.JUSTIFY, "false"); props.setProperty(BigdataSail.Options.TEXT_INDEX, "false"); props.setProperty(BigdataSail.Options.INLINE_DATE_TIMES, "true"); props.setProperty(BigdataSail.Options.INLINE_DATE_TIMES_TIMEZONE, "GMT"); // No disk file. props.setProperty(com.bigdata.journal.Options.BUFFER_MODE, BufferMode.Transient.toString()); return props; }
Example #2
Source File: TestBigdataGraphEmbeddedRepository.java From database with GNU General Public License v2.0 | 6 votes |
public void setProperties() { Properties props = System.getProperties(); // no inference props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName()); props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, NoVocabulary.class.getName()); props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); props.setProperty(BigdataSail.Options.JUSTIFY, "false"); // no text index props.setProperty(BigdataSail.Options.TEXT_INDEX, "false"); // triples mode props.setProperty(BigdataSail.Options.QUADS, "false"); props.setProperty(BigdataSail.Options.STATEMENT_IDENTIFIERS, "false"); }
Example #3
Source File: BigdataSailFactory.java From database with GNU General Public License v2.0 | 6 votes |
public Sail getSail(final SailImplConfig config) throws SailConfigException { if (!TYPE.equals(config.getType())) { throw new SailConfigException( "Invalid type: " + config.getType()); } if (!(config instanceof BigdataSailConfig)) { throw new SailConfigException( "Invalid type: " + config.getClass()); } try { final BigdataSailConfig bigdataConfig = (BigdataSailConfig)config; final Properties properties = bigdataConfig.getProperties(); return new BigdataSail(properties); } catch (Exception ex) { throw new SailConfigException(ex); } }
Example #4
Source File: AbstractBigdataGraphTestCase.java From database with GNU General Public License v2.0 | 6 votes |
protected Properties getProperties() { final Properties p = new Properties(); p.setProperty(Journal.Options.BUFFER_MODE, BufferMode.MemStore.toString()); /* * TODO Test both triples and quads. * * Note: We need to use different data files for quads (trig). If we use * trig for a triples mode kb then we get errors (context bound, but not * quads mode). */ p.setProperty(BigdataSail.Options.TRIPLES_MODE, "true"); // p.setProperty(BigdataSail.Options.QUADS_MODE, "true"); p.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); return p; }
Example #5
Source File: TestInlineURIs.java From database with GNU General Public License v2.0 | 6 votes |
/** * Please set your database properties here, except for your journal file, * please DO NOT SPECIFY A JOURNAL FILE. */ @Override public Properties getProperties() { final Properties props = new Properties(super.getProperties()); /* * Turn off inference. */ props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName()); props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); props.setProperty(BigdataSail.Options.JUSTIFY, "false"); props.setProperty(BigdataSail.Options.TEXT_INDEX, "false"); return props; }
Example #6
Source File: LoadPdb.java From database with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { File file = new File("tmp-1Y26.jnl"); Properties properties = new Properties(); properties.setProperty(BigdataSail.Options.FILE, file.getAbsolutePath()); BigdataSail sail = new BigdataSail(properties); Repository repo = new BigdataSailRepository(sail); repo.initialize(); if(false) { sail.getDatabase().getDataLoader().loadData( "contrib/src/problems/alex/1Y26.rdf", new File("contrib/src/problems/alex/1Y26.rdf").toURI() .toString(), RDFFormat.RDFXML); sail.getDatabase().commit(); } // loadSomeDataFromADocument(repo, "contrib/src/problems/alex/1Y26.rdf"); // readSomeData(repo); executeSelectQuery(repo, "SELECT * WHERE { ?s ?p ?o }"); }
Example #7
Source File: BigdataGASRunner.java From database with GNU General Public License v2.0 | 6 votes |
private void loadFiles(final BigdataSail sail, final String[] loadSet) throws Exception { boolean ok = false; final SailConnection cxn = sail.getUnisolatedConnection(); try { final GraphLoader loader = new BigdataSailGraphLoader(cxn); for (String f : loadSet) { loader.loadGraph(null/* fallback */, f/* resource */); } cxn.commit(); ok = true; } finally { if (!ok) cxn.rollback(); cxn.close(); } }
Example #8
Source File: BigdataSparqlTest.java From database with GNU General Public License v2.0 | 6 votes |
@Override protected Repository newRepository() throws RepositoryException { if (true) { final Properties props = getProperties(); if (cannotInlineTests.contains(testURI)){ // The test can not be run using XSD inlining. props.setProperty(Options.INLINE_XSD_DATATYPE_LITERALS, "false"); props.setProperty(Options.INLINE_DATE_TIMES, "false"); } if(unicodeStrengthIdentical.contains(testURI)) { // Force identical Unicode comparisons. props.setProperty(Options.COLLATOR, CollatorEnum.JDK.toString()); props.setProperty(Options.STRENGTH, StrengthEnum.Identical.toString()); } final BigdataSail sail = new BigdataSail(props); // return new DatasetRepository(new BigdataSailRepository(sail)); return new BigdataSailRepository(sail); } else { return new DatasetRepository(new SailRepository(new MemoryStore())); } }
Example #9
Source File: BigdataRepositoryFactory.java From database with GNU General Public License v2.0 | 6 votes |
public Repository getRepository(final RepositoryImplConfig config) throws RepositoryConfigException { if (!TYPE.equals(config.getType())) { throw new RepositoryConfigException( "Invalid type: " + config.getType()); } if (!(config instanceof BigdataRepositoryConfig)) { throw new RepositoryConfigException( "Invalid type: " + config.getClass()); } try { final BigdataRepositoryConfig bigdataConfig = (BigdataRepositoryConfig)config; final Properties properties = bigdataConfig.getProperties(); final BigdataSail sail = new BigdataSail(properties); return new BigdataSailRepository(sail); } catch (Exception ex) { throw new RepositoryConfigException(ex); } }
Example #10
Source File: TestPaths.java From database with GNU General Public License v2.0 | 5 votes |
@Override public Properties getProperties() { Properties props = super.getProperties(); props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName()); props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, NoVocabulary.class.getName()); props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); props.setProperty(BigdataSail.Options.JUSTIFY, "false"); props.setProperty(BigdataSail.Options.TEXT_INDEX, "false"); return props; }
Example #11
Source File: SampleBlazegraphSesameEmbedded.java From blazegraph-samples with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws IOException, OpenRDFException { // load journal properties from resources final Properties props = loadProperties("/blazegraph.properties"); // instantiate a sail final BigdataSail sail = new BigdataSail(props); final Repository repo = new BigdataSailRepository(sail); try{ repo.initialize(); /* * Load data from resources * src/main/resources/data.n3 */ loadDataFromResources(repo, "/data.n3", ""); final String query = "select * {<http://blazegraph.com/blazegraph> ?p ?o}"; final TupleQueryResult result = executeSelectQuery(repo, query, QueryLanguage.SPARQL); try { while(result.hasNext()){ final BindingSet bs = result.next(); log.info(bs); } } finally { result.close(); } } finally { repo.shutDown(); } }
Example #12
Source File: HistoryServiceFactory.java From database with GNU General Public License v2.0 | 5 votes |
HistoryChangeLogListener(final BigdataSailConnection conn) { this.conn = conn; this.tripleStore = conn.getTripleStore(); this.revisionTimestamp = getRevisionTimestamp(tripleStore); this.minReleaseAge = Long .valueOf(tripleStore .getProperty( BigdataSail.Options.HISTORY_SERVICE_MIN_RELEASE_AGE, BigdataSail.Options.DEFAULT_HISTORY_SERVICE_MIN_RELEASE_AGE)); /* * TODO We should be able to reach the timestamp service from the * index manager. We want to use the globally agreed on clock for * the current time when making the decision to prune the head of * the index. */ releaseTime = (System.currentTimeMillis() - minReleaseAge) + 1; if (log.isInfoEnabled()) { log.info("minReleaseAge=" + minReleaseAge + ", releaseTime=" + releaseTime); } }
Example #13
Source File: BigdataStoreTest.java From database with GNU General Public License v2.0 | 5 votes |
/** * Overridden to destroy the backend database and its files on the disk. */ @Override public void tearDown() throws Exception { final IIndexManager backend = sail == null ? null : ((BigdataSail) sail).getIndexManager(); super.tearDown(); if (backend != null) backend.destroy(); }
Example #14
Source File: BigdataGraphFactory.java From database with GNU General Public License v2.0 | 5 votes |
/** * Create a new local in-memory bigdata instance with the supplied value * factory. */ public static BigdataGraph create(final BlueprintsValueFactory vf, final Properties props) throws Exception { final BigdataSail sail = (BigdataSail) BigdataSailFactory.createSail(); sail.initialize(); return new BigdataGraphEmbedded(sail, vf, props); }
Example #15
Source File: LocalGOMTestCase.java From database with GNU General Public License v2.0 | 5 votes |
protected void setUp() throws Exception { // instantiate a sail and a Sesame repository m_sail = new BigdataSail(getProperties()); m_repo = new BigdataSailRepository(m_sail); m_repo.initialize(); m_vf = m_sail.getValueFactory(); // Note: This uses a mock endpoint URL. om = new ObjectManager("http://localhost" + BigdataStatics.getContextPath() + "/sparql", m_repo); }
Example #16
Source File: BigdataSPARQLUpdateConformanceTest.java From database with GNU General Public License v2.0 | 5 votes |
@Override protected BigdataSailRepository newRepository() throws RepositoryException { // if (true) { final Properties props = getProperties(); // if (cannotInlineTests.contains(testURI)){ // // The test can not be run using XSD inlining. // props.setProperty(Options.INLINE_XSD_DATATYPE_LITERALS, "false"); // props.setProperty(Options.INLINE_DATE_TIMES, "false"); // } // // if(unicodeStrengthIdentical.contains(testURI)) { // // Force identical Unicode comparisons. // props.setProperty(Options.COLLATOR, CollatorEnum.JDK.toString()); // props.setProperty(Options.STRENGTH, StrengthEnum.Identical.toString()); // } final BigdataSail sail = new BigdataSail(props); // return new ContextAwareRepository(new BigdataSailRepository(sail)); return new BigdataSailRepository(sail); // } else { // /* // * Run against openrdf. // */ // SailRepository repo = new SailRepository(new MemoryStore()); // // return new ContextAwareRepository(repo); // } }
Example #17
Source File: AbstractASTEvaluationTestCase.java From database with GNU General Public License v2.0 | 5 votes |
@Override public Properties getProperties() { // Note: clone to avoid modifying!!! final Properties properties = (Properties) super.getProperties().clone(); // turn on quads. properties.setProperty(AbstractTripleStore.Options.QUADS, "true"); // TM not available with quads. properties.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE,"false"); // // override the default vocabulary. // properties.setProperty(AbstractTripleStore.Options.VOCABULARY_CLASS, // NoVocabulary.class.getName()); // turn off axioms. properties.setProperty(AbstractTripleStore.Options.AXIOMS_CLASS, NoAxioms.class.getName()); // no persistence. properties.setProperty(com.bigdata.journal.Options.BUFFER_MODE, BufferMode.Transient.toString()); return properties; }
Example #18
Source File: SampleBlazegraphCustomFunctionEmbedded.java From blazegraph-samples with GNU General Public License v2.0 | 5 votes |
public static Repository createRepository(){ final Properties props = new Properties(); props.put(Options.BUFFER_MODE, BufferMode.DiskRW); props.put(Options.FILE, journalFile); final BigdataSail sail = new BigdataSail(props); final Repository repo = new BigdataSailRepository(sail); return repo; }
Example #19
Source File: AST2BOpContext.java From database with GNU General Public License v2.0 | 5 votes |
/** * Return the effective statement limit for a DESCRIBE query. * * @param projection * The query projection. * * @return The effective statement limit. * * @see QueryHints#DESCRIBE_STATEMENT_LIMIT */ public int getDescribeStatementLimit(final ProjectionNode projection) { // The effective limit. Integer limit = projection.getDescribeStatementLimit(); if (limit != null) { /* * Explicitly specified on the project. E.g., set by a query hint or * through code. */ return limit; } /* * Consult the KB for a configured default behavior. */ final String limitStr = db.getProperties().getProperty( BigdataSail.Options.DESCRIBE_STATEMENT_LIMIT); if (limitStr != null) { // The KB has specified a default DESCRIBE algorithm. limit = Integer.valueOf(limitStr); } else { // Use the default specified on QueryHints. limit = QueryHints.DEFAULT_DESCRIBE_STATEMENT_LIMIT; } return limit; }
Example #20
Source File: BasicRepositoryProvider.java From tinkerpop3 with GNU General Public License v2.0 | 5 votes |
/** * Open and initialize a BigdataSailRepository using the supplied config * properties. You must specify a journal file in the properties. * * @param props * config properties * @return * an open and initialized repository */ public static BigdataSailRepository open(final Properties props) { if (props.getProperty(Journal.Options.FILE) == null) { throw new IllegalArgumentException(); } final BigdataSail sail = new BigdataSail(props); final BigdataSailRepository repo = new BigdataSailRepository(sail); Code.wrapThrow(() -> repo.initialize()); return repo; }
Example #21
Source File: TestRollbacks.java From database with GNU General Public License v2.0 | 5 votes |
private void doTest(final int maxCounter) throws InterruptedException, Exception { /* * Note: Each run needs to be in a distinct namespace since we otherwise * can have side-effects through the BigdataValueFactoryImpl for a given * namespace. */ final Properties properties = new Properties(getProperties()); properties.setProperty(BigdataSail.Options.NAMESPACE, "kb" + runCount.incrementAndGet()); final BigdataSail sail = getSail(properties); try { // Note: Modified to use the BigdataSailRepository rather than the base SailRepository class. final BigdataSailRepository repo = new BigdataSailRepository(sail); repo.initialize(); runConcurrentStuff(repo,maxCounter); } finally { final IIndexManager db = sail.getIndexManager(); try { if (sail.isOpen()) { try { sail.shutDown(); } catch (Throwable t) { log.error(t, t); } } } finally { db.destroy(); } } }
Example #22
Source File: TestMultiInlineURIHandlersSingleNamespace.java From database with GNU General Public License v2.0 | 5 votes |
/** * Please set your database properties here, except for your journal file, * please DO NOT SPECIFY A JOURNAL FILE. */ @Override public Properties getProperties() { final Properties props = new Properties(super.getProperties()); /* * Turn off inference. */ props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName()); props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); props.setProperty(BigdataSail.Options.JUSTIFY, "false"); // Test with TestVocabulary Vocabulary props.setProperty(Options.VOCABULARY_CLASS, TestMultiVocabulary.class.getName()); // Test with TestVocabulary InlineURIHandler props.setProperty(Options.INLINE_URI_FACTORY_CLASS, TestNamespaceMultiURIHandler.class.getName()); // test w/o axioms - they imply a predefined vocab. props.setProperty(Options.AXIOMS_CLASS, NoAxioms.class.getName()); // test w/o the full text index. props.setProperty(Options.TEXT_INDEX, "false"); return props; }
Example #23
Source File: TestRollbacksTM.java From database with GNU General Public License v2.0 | 5 votes |
@Override public Properties getProperties() { final Properties props = super.getProperties(); props.setProperty(BigdataSail.Options.AXIOMS_CLASS, RdfsAxioms.class.getName()); props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, RDFSVocabulary.class.getName()); props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "true"); props.setProperty(BigdataSail.Options.JUSTIFY, "true"); return props; }
Example #24
Source File: StressTest_REST_MultiTenancy.java From database with GNU General Public License v2.0 | 5 votes |
private void createNamespace(final String namespace) throws Exception { // final Properties properties = new Properties(); // final Properties properties = getTestMode().getProperties(); // FIXME BLZG-2023: Use the indicated test mode, but also test for triplesPlusTM. final Properties properties = TestMode.triplesPlusTruthMaintenance.getProperties(); properties.put(BigdataSail.Options.NAMESPACE, namespace); log.warn(String.format("Create namespace %s...", namespace)); m_mgr.createRepository(namespace, properties); log.warn(String.format("Create namespace %s done", namespace)); }
Example #25
Source File: AbstractTestNanoSparqlClient.java From database with GNU General Public License v2.0 | 5 votes |
private void createTripleStore( final IIndexManager indexManager, final String namespace, final Properties properties) throws InterruptedException, ExecutionException, SailException { if(log.isInfoEnabled()) log.info("KB namespace=" + namespace); boolean ok = false; final BigdataSail sail = new BigdataSail(namespace,indexManager); try { sail.initialize(); sail.create(properties); if(log.isInfoEnabled()) log.info("Created tripleStore: " + namespace); ok = true; return; } finally { if (!ok) sail.shutDown(); } // AbstractApiTask.submitApiTask(indexManager, new CreateKBTask(namespace, // properties)).get(); // // /** // * Return a view of the new KB to the caller. // * // * Note: The caller MUST NOT attempt to modify this KB view outside of // * the group commit mechanisms. Therefore I am now returning a read-only // * view. // */ // final AbstractTripleStore tripleStore = (AbstractTripleStore) indexManager // .getResourceLocator().locate(namespace, ITx.READ_COMMITTED); // // assert tripleStore != null; // // return tripleStore; }
Example #26
Source File: BigdataGASRunner.java From database with GNU General Public License v2.0 | 5 votes |
@Override public void loadFiles() throws IOException { final BigdataOptionData opt = getOptionData(); final Journal jnl = opt.jnl; final String namespace = opt.namespace; final String[] loadSet = opt.loadSet.toArray(new String[0]); // Load data using the unisolated view. final AbstractTripleStore kb = (AbstractTripleStore) jnl .getResourceLocator().locate(namespace, ITx.UNISOLATED); if (opt.newKB && loadSet.length > 0) { final BigdataSail sail = new BigdataSail(kb); try { try { sail.initialize(); loadFiles(sail, loadSet); } finally { if (sail.isOpen()) sail.shutDown(); } } catch (Exception ex) { throw new RuntimeException(ex); } } // total #of edges in that graph. opt.nedges = kb.getStatementCount(); }
Example #27
Source File: TestNanoSparqlServer.java From database with GNU General Public License v2.0 | 5 votes |
protected Properties getTripleStoreProperties() { final Properties tripleStoreProperties = new Properties(); { tripleStoreProperties.setProperty( BigdataSail.Options.TRUTH_MAINTENANCE, "false"); tripleStoreProperties.setProperty(BigdataSail.Options.TRIPLES_MODE, "true"); } return tripleStoreProperties; }
Example #28
Source File: BigdataSPARQLUpdateTest.java From database with GNU General Public License v2.0 | 5 votes |
@Override protected Repository newRepository() throws RepositoryException { final Properties props = getProperties(); final BigdataSail sail = new BigdataSail(props); backend = sail.getIndexManager(); return new BigdataSailRepository(sail); // if (true) { // final Properties props = getProperties(); // // if (cannotInlineTests.contains(testURI)){ // // The test can not be run using XSD inlining. // props.setProperty(Options.INLINE_XSD_DATATYPE_LITERALS, "false"); // props.setProperty(Options.INLINE_DATE_TIMES, "false"); // } // // if(unicodeStrengthIdentical.contains(testURI)) { // // Force identical Unicode comparisons. // props.setProperty(Options.COLLATOR, CollatorEnum.JDK.toString()); // props.setProperty(Options.STRENGTH, StrengthEnum.Identical.toString()); // } // // final BigdataSail sail = new BigdataSail(props); // return new DatasetRepository(new BigdataSailRepository(sail)); // } else { // return new DatasetRepository(new SailRepository(new MemoryStore())); // } }
Example #29
Source File: BigdataComplexSparqlQueryTest.java From database with GNU General Public License v2.0 | 5 votes |
@Override protected Repository newRepository() throws RepositoryException { final Properties props = getProperties(); final BigdataSail sail = new BigdataSail(props); backend = sail.getIndexManager(); return new BigdataSailRepository(sail); // if (true) { // final Properties props = getProperties(); // // if (cannotInlineTests.contains(testURI)){ // // The test can not be run using XSD inlining. // props.setProperty(Options.INLINE_XSD_DATATYPE_LITERALS, "false"); // props.setProperty(Options.INLINE_DATE_TIMES, "false"); // } // // if(unicodeStrengthIdentical.contains(testURI)) { // // Force identical Unicode comparisons. // props.setProperty(Options.COLLATOR, CollatorEnum.JDK.toString()); // props.setProperty(Options.STRENGTH, StrengthEnum.Identical.toString()); // } // // final BigdataSail sail = new BigdataSail(props); // return new DatasetRepository(new BigdataSailRepository(sail)); // } else { // return new DatasetRepository(new SailRepository(new MemoryStore())); // } }
Example #30
Source File: TestGeoSpatialServiceEvaluationQuads.java From database with GNU General Public License v2.0 | 4 votes |
@Override public Properties getProperties() { // Note: clone to avoid modifying!!! final Properties properties = (Properties) super.getProperties().clone(); // turn on quads. properties.setProperty(AbstractTripleStore.Options.QUADS, "true"); // TM not available with quads. properties.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE,"false"); // turn off axioms. properties.setProperty(AbstractTripleStore.Options.AXIOMS_CLASS, NoAxioms.class.getName()); // no persistence. properties.setProperty(com.bigdata.journal.Options.BUFFER_MODE, BufferMode.Transient.toString()); // enable GeoSpatial index properties.setProperty( com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL, "true"); properties.setProperty( com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DATATYPE_CONFIG + ".0", "{\"config\": " + "{ \"uri\": \"http://www.bigdata.com/rdf/geospatial#geoSpatialLiteral\", " + "\"fields\": [ " + "{ \"valueType\": \"DOUBLE\", \"multiplier\": \"100000\", \"serviceMapping\": \"LATITUDE\" }, " + "{ \"valueType\": \"DOUBLE\", \"multiplier\": \"100000\", \"serviceMapping\": \"LONGITUDE\" }, " + "{ \"valueType\": \"LONG\", \"serviceMapping\" : \"TIME\" } " + "]}}"); properties.setProperty( com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DEFAULT_DATATYPE, "http://www.bigdata.com/rdf/geospatial#geoSpatialLiteral"); return properties; }