com.bigdata.journal.BufferMode Java Examples

The following examples show how to use com.bigdata.journal.BufferMode. 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: TestOverflowGRS.java    From database with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Overridden to specify the {@link BufferMode#Disk} mode.
 */
public Properties getProperties() {
    
    final Properties properties = new Properties(super.getProperties());
    
    // overrides value set in the superclass.
    properties.setProperty(Options.BUFFER_MODE,BufferMode.Disk.toString());
    
    // restrict the test to one data service [dataService0].
    properties.setProperty(EmbeddedClient.Options.NDATA_SERVICES,"1");

    // use a very low threshold for an index build.
    properties.setProperty(EmbeddedClient.Options.COPY_INDEX_THRESHOLD,
            Integer.toString(copyIndexThreshold));

    // pre-size the journal to the mimumum extent.
    properties.setProperty(EmbeddedClient.Options.INITIAL_EXTENT,
            Long.toString(Options.minimumInitialExtent));

    // overflow as soon as we exceed that minimum extent.
    properties.setProperty(EmbeddedClient.Options.MAXIMUM_EXTENT,
            Long.toString(Options.minimumInitialExtent));

    return properties;
    
}
 
Example #2
Source File: AbstractBigdataExprBuilderTestCase.java    From database with GNU General Public License v2.0 6 votes vote down vote up
protected Properties getProperties() {

        final Properties properties = new Properties();

        /*
         * Note: we execute the parser tests in quads mode, since some of them
         * use constructs such as GRAPH keywords for which exceptions are
         * thrown at parse time in triples mode. 
         */
        properties.setProperty(AbstractTripleStore.Options.QUADS, "true");

        // 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());

        // Note: No persistence.
        properties.setProperty(com.bigdata.journal.Options.BUFFER_MODE,
                BufferMode.Transient.toString());
        
        return properties;

    }
 
Example #3
Source File: TestMillisecondPrecisionForInlineDateTimes.java    From database with GNU General Public License v2.0 6 votes vote down vote up
/**
   * 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 #4
Source File: TestServiceRegistry.java    From database with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Overriden: test must be executed in triples mode (test_customService)
  */
 @Override
 protected Properties getProperties() {

    final Properties properties = new Properties();

    // 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());

    // Note: No persistence.
    properties.setProperty(com.bigdata.journal.Options.BUFFER_MODE,
            BufferMode.Transient.toString());
    
    return properties;

}
 
Example #5
Source File: TestTicket473.java    From database with GNU General Public License v2.0 6 votes vote down vote up
private Properties getProperties() {
    
    final Properties props = new Properties();
    props.setProperty(BigdataSail.Options.NAMESPACE,"foo.bar.snapdragon.kb");
    props.setProperty(com.bigdata.journal.Options.BUFFER_MODE,BufferMode.DiskRW.name());
    props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_CAPACITY,"4000");
    props.setProperty(IndexMetadata.Options.BTREE_BRANCHING_FACTOR,"128");

    // TODO Also fails with sessionProtection (minReleaseAge:=0).
    props.setProperty(AbstractTransactionService.Options.MIN_RELEASE_AGE,"1");
    props.setProperty(AbstractTripleStore.Options.TEXT_INDEX,"false");
    props.setProperty(AbstractTripleStore.Options.AXIOMS_CLASS,NoAxioms.class.getName());
    props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE,"false");
    props.setProperty(AbstractTripleStore.Options.JUSTIFY,"false");
    props.setProperty(com.bigdata.rdf.store.AbstractTripleStore.Options.STATEMENT_IDENTIFIERS,"false");
    props.setProperty(com.bigdata.rdf.store.AbstractTripleStore.Options.QUADS_MODE,"false");
    props.setProperty(com.bigdata.journal.Options.MAXIMUM_EXTENT,"209715200");
    props.setProperty(BigdataSail.Options.BUFFER_CAPACITY,"100000");
    props.setProperty(AbstractTripleStore.Options.BLOOM_FILTER,"false");
    props.setProperty(com.bigdata.journal.Options.FILE,"ticket473.jnl");

    return props;
    
}
 
Example #6
Source File: LocalGOMTestCase.java    From database with GNU General Public License v2.0 6 votes vote down vote up
protected Properties getProperties() throws Exception {
    	
        final Properties properties = new Properties();

        // create a backing file for the database
        final File journal = File.createTempFile("bigdata", ".jnl");
        properties.setProperty(
                BigdataSail.Options.FILE,
                journal.getAbsolutePath()
                );
        properties.setProperty(Options.BUFFER_MODE, BufferMode.DiskRW.toString());
        properties.setProperty(AbstractTripleStore.Options.TEXT_INDEX, "false");
//        properties.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_CAPACITY, "200");
//        properties.setProperty("com.bigdata.namespace.kb.spo.SPO.com.bigdata.btree.BTree.branchingFactor", "200");
//        properties.setProperty("com.bigdata.namespace.kb.spo.POS.com.bigdata.btree.BTree.branchingFactor", "200");
//        properties.setProperty("com.bigdata.namespace.kb.spo.OSP.com.bigdata.btree.BTree.branchingFactor", "200");
//        properties.setProperty("com.bigdata.namespace.kb.spo.BLOBS.com.bigdata.btree.BTree.branchingFactor", "200");
//        properties.setProperty("com.bigdata.namespace.kb.lex.TERM2ID.com.bigdata.btree.BTree.branchingFactor", "200");
//        properties.setProperty("com.bigdata.namespace.kb.lex.ID2TERM.com.bigdata.btree.BTree.branchingFactor", "200");
        properties.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false");

        return properties;
        
    }
 
Example #7
Source File: StressTestConcurrentRestApiRequests.java    From database with GNU General Public License v2.0 5 votes vote down vote up
static public Test suite() {

        if (true) {

            return ProxySuiteHelper.suiteWhenStandalone(
                    StressTestConcurrentRestApiRequests.class, //
                    "test.*",// normal
                    new LinkedHashSet<BufferMode>(Arrays
                            .asList(new BufferMode[] {
                            // BufferMode.Transient,
                            // BufferMode.DiskWORM,
                            BufferMode.MemStore,
//                             BufferMode.DiskRW,
                            })), TestMode.quads);

        } else if(true) {

            return ProxySuiteHelper.suiteWhenStandalone(
                    StressTestConcurrentRestApiRequests.class, //
//                    "stressTest_concurrentClients_2Hours",// 2 hours!
                    "stressTest_concurrentClients_10Minutes", // 10m
                    new LinkedHashSet<BufferMode>(Arrays
                            .asList(new BufferMode[] { BufferMode.DiskRW, })),
                    TestMode.quads);
        } else {

            return ProxySuiteHelper.suiteWhenStandalone(
                    StressTestConcurrentRestApiRequests.class, //
                    "stressTest_concurrentClients_24Hours",// 24 hours!
                    new LinkedHashSet<BufferMode>(Arrays
                            .asList(new BufferMode[] { BufferMode.DiskRW, })),
                    TestMode.quads);
        }

    }
 
Example #8
Source File: TestMROWTransactions.java    From database with GNU General Public License v2.0 5 votes vote down vote up
protected Properties getProperties(final int retention,
        final boolean isolatableIndices) {

    final Properties props = getProperties();
    
    props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false");
    props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName());
    props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, NoVocabulary.class.getName());
    props.setProperty(BigdataSail.Options.JUSTIFY, "false");
    props.setProperty(BigdataSail.Options.TEXT_INDEX, "false");
    // props.setProperty(Options.WRITE_CACHE_BUFFER_COUNT, "3");

    // ensure using RWStore
    props.setProperty(Options.BUFFER_MODE, BufferMode.DiskRW.toString());
    // props.setProperty(RWStore.Options.MAINTAIN_BLACKLIST, "false");
    // props.setProperty(RWStore.Options.OVERWRITE_DELETE, "true");
    // props.setProperty(Options.CREATE_TEMP_FILE, "false");
    // props.setProperty(Options.FILE, "/Volumes/SSDData/csem.jnl");

    // props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_CAPACITY, "20");
    // props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_SCAN, "0");
    props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_CAPACITY, "500");
    props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_SCAN, "10");

    setProperties(props, retention, isolatableIndices);
    
    return props;
}
 
Example #9
Source File: TestMROWTransactions.java    From database with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Properties getProperties() {

    final Properties props = super.getProperties();

    props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false");
    props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName());
    props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, NoVocabulary.class.getName());
    props.setProperty(BigdataSail.Options.JUSTIFY, "false");
    props.setProperty(BigdataSail.Options.TEXT_INDEX, "false");
    // props.setProperty(Options.WRITE_CACHE_BUFFER_COUNT, "3");

    // ensure using RWStore
    props.setProperty(Options.BUFFER_MODE, BufferMode.DiskRW.toString());
    // props.setProperty(RWStore.Options.MAINTAIN_BLACKLIST, "false");
    // props.setProperty(RWStore.Options.OVERWRITE_DELETE, "true");
    // props.setProperty(Options.CREATE_TEMP_FILE, "false");
    // props.setProperty(Options.FILE, "/Volumes/SSDData/csem.jnl");

    // props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_CAPACITY, "20");
    // props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_SCAN, "0");
    props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_CAPACITY, "500");
    props.setProperty(IndexMetadata.Options.WRITE_RETENTION_QUEUE_SCAN, "10");

    return props;

}
 
Example #10
Source File: AbstractEmbeddedFederationTestCase.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public Properties getProperties() {
    
    final Properties properties = new Properties(super.getProperties());
    
    // Note: uses transient mode for tests.
    properties.setProperty(Options.BUFFER_MODE, BufferMode.Transient
            .toString());
    
    // when the data are persistent use the test to name the data directory.
    properties.setProperty(EmbeddedClient.Options.DATA_DIR, getName());
    
    // when the data are persistent use the test to name the data directory.
    properties.setProperty(DistributedTransactionService.Options.DATA_DIR,
            new File(getName(), "txService").toString());
    
    /*
     * Disable the o/s specific statistics collection for the test run.
     * 
     * Note: You only need to enable this if you are trying to track the
     * statistics or if you are testing index partition moves, since moves
     * rely on the per-host counters collected from the o/s.
     */
    properties.setProperty(
            AbstractClient.Options.COLLECT_PLATFORM_STATISTICS, "false");

    // disable moves.
    properties.setProperty(
            ResourceManager.Options.MAXIMUM_MOVES_PER_TARGET, "0");

    return properties;
    
}
 
Example #11
Source File: TestTicket1899.java    From database with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Properties getProperties() {

    // Note: clone to avoid modifying!!!
    final Properties properties = (Properties) super.getProperties().clone();

    // turn on quads.
    properties.setProperty(AbstractTripleStore.Options.QUADS, "false");

    // 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 with default configuration
    properties.setProperty(com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL, "true");

    properties.setProperty(
        com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DEFAULT_DATATYPE,
        "http://www.bigdata.com/rdf/geospatial/literals/v1#lat-lon");
    
    return properties;

}
 
Example #12
Source File: TestMemStore.java    From database with GNU General Public License v2.0 5 votes vote down vote up
private void verifyCommitIndex(final Journal jrnl, int expectedRecords) {
       // Check if journal is DISKRW
       if (jrnl.getBufferStrategy().getBufferMode() != BufferMode.MemStore) {            
           System.err.println("Buffer mode should be MemStore not " + jrnl.getBufferStrategy().getBufferMode());
           
           return;
       }
       
       final MemStrategy strategy = (MemStrategy) jrnl.getBufferStrategy();
       
       final IIndex commitRecordIndex = jrnl.getReadOnlyCommitRecordIndex();
       if (commitRecordIndex == null) {
           System.err.println("Unexpected null commit record index");
           return;
       }

       final IndexMetadata metadata = commitRecordIndex
               .getIndexMetadata();

       final byte[] zeroKey = metadata.getTupleSerializer()
               .serializeKey(0L);

       final byte[] releaseKey = metadata.getTupleSerializer()
          .serializeKey(System.currentTimeMillis());

       final int removed = jrnl.removeCommitRecordEntries(zeroKey, releaseKey);
     
       assertTrue(removed == expectedRecords);

       jrnl.commit();
}
 
Example #13
Source File: TestGeoSpatialDefaults.java    From database with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Properties getProperties() {

    // Note: clone to avoid modifying!!!
    final Properties properties = (Properties) super.getProperties().clone();

    // turn on quads.
    properties.setProperty(AbstractTripleStore.Options.QUADS, "false");

    // 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 with default configuration
    properties.setProperty(com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL, "true");

    properties.setProperty(
        com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DEFAULT_DATATYPE,
        "http://www.bigdata.com/rdf/geospatial/literals/v1#lat-lon");
    
    return properties;

}
 
Example #14
Source File: TestRebuildTextIndex.java    From database with GNU General Public License v2.0 5 votes vote down vote up
static public Test suite() {

       return ProxySuiteHelper.suiteWhenStandalone(TestRebuildTextIndex.class,
             "test_rebuildTextIndex",
             Collections.singleton(BufferMode.DiskRW)
             );
    }
 
Example #15
Source File: TestBigdataSailEmbeddedFederationWithQuads.java    From database with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Properties getProperties() {

    final Properties properties = new Properties(super.getProperties());

    properties.setProperty(Options.QUADS_MODE, "true");
    
    properties.setProperty(Options.TRUTH_MAINTENANCE, "false");

    // Note: uses transient mode for tests.
    properties.setProperty(Options.BUFFER_MODE, BufferMode.Transient
            .toString());

    /*
     * Properties which are specific to the (embedded) federation.
     */

    /*
     * Only one data service. The EmbeddedFederation can not support more
     * than one FederatedQueryEngine peer because the EmbeddedClient gets
     * only a single ServiceID assigned.
     */
    properties.setProperty(EmbeddedClient.Options.NDATA_SERVICES, "1");

    // when the data are persistent use the test to name the data directory.
    properties.setProperty(EmbeddedClient.Options.DATA_DIR, NAMESPACE);
    
    // when the data are persistent use the test to name the data directory.
    properties.setProperty(DistributedTransactionService.Options.DATA_DIR,
            new File(NAMESPACE, "txService").toString());
    
    /*
     * Disable the o/s specific statistics collection for the test run.
     * 
     * Note: You only need to enable this if you are trying to track the
     * statistics or if you are testing index partition moves, since moves
     * rely on the per-host counters collected from the o/s.
     */
    properties.setProperty(
            AbstractClient.Options.COLLECT_PLATFORM_STATISTICS, "false");

    // disable moves.
    properties.setProperty(
            ResourceManager.Options.MAXIMUM_MOVES_PER_TARGET, "0");

    return properties;
    
}
 
Example #16
Source File: BigdataSPARQLUpdateConformanceTest.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Note: This method may be overridden in order to run the test suite
     * against other variations of the bigdata backend.
     */
    protected Properties getProperties() {

        final Properties props = new Properties();
        
//        final File journal = BigdataStoreTest.createTempFile();
//        
//        props.setProperty(BigdataSail.Options.FILE, journal.getAbsolutePath());

        props.setProperty(Options.BUFFER_MODE, BufferMode.Transient.toString());
        
        // quads mode: quads=true, sids=false, axioms=NoAxioms, vocab=NoVocabulary
        props.setProperty(Options.QUADS_MODE, "true");

        // no justifications
        props.setProperty(Options.JUSTIFY, "false");
        
        // no query time inference
        props.setProperty(Options.QUERY_TIME_EXPANDER, "false");
        
//        // auto-commit only there for TCK
//        props.setProperty(Options.ALLOW_AUTO_COMMIT, "true");
        
        // exact size only there for TCK
        props.setProperty(Options.EXACT_SIZE, "true");
        
//        props.setProperty(Options.COLLATOR, CollatorEnum.ASCII.toString());
        
//      Force identical unicode comparisons (assuming default COLLATOR setting).
//        props.setProperty(Options.STRENGTH, StrengthEnum.Identical.toString());
        
        /*
         * disable read/write transactions since this class runs against the
         * unisolated connection.
         */
        props.setProperty(Options.ISOLATABLE_INDICES, "false");
        
        // disable truth maintenance in the SAIL
        props.setProperty(Options.TRUTH_MAINTENANCE, "false");
        
        // use a random namespace to keep the values in the actual repo
        // separate from the values in the expected repo
        props.setProperty(Options.NAMESPACE, "kb-" + UUID.randomUUID().toString());
        
        return props;
        
    }
 
Example #17
Source File: AbstractTestCase.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/**
     * <p>
     * Returns properties read from a hierarchy of sources. The underlying
     * properties read from those sources are cached, but a new properties
     * object is returned on each invocation (to prevent side effects by the
     * caller).
     * </p>
     * <p>
     * In general, a test configuration critically relies on both the properties
     * returned by this method and the appropriate properties must be provided
     * either through the command line or in a properties file.
     * </p>
     * 
     * @return A new properties object.
     */
    public Properties getProperties() {
        
        if( m_properties == null ) {
            
            /*
             * Read properties from a hierarchy of sources and cache a
             * reference.
             */
            m_properties = super.getProperties();

            // disregard the inherited properties.
//            m_properties = new Properties();
            

            // m_properties = new Properties( m_properties );

            // disable statistics collection (federation)
            m_properties
                    .setProperty(
                            AbstractClient.Options.COLLECT_PLATFORM_STATISTICS,
                            "false");
            m_properties.setProperty(
                    AbstractClient.Options.COLLECT_QUEUE_STATISTICS, "false");
            m_properties.setProperty(AbstractClient.Options.HTTPD_PORT, "-1");

            // disable statistics collection (journal)
            m_properties.setProperty(
                    Journal.Options.COLLECT_PLATFORM_STATISTICS, "false");
            m_properties.setProperty(Journal.Options.COLLECT_QUEUE_STATISTICS,
                    "false");
            m_properties
                    .setProperty(Journal.Options.HTTPD_PORT, "-1"/* none */);

            m_properties.setProperty(Options.BUFFER_MODE,BufferMode.Disk.toString());
//            m_properties.setProperty(Options.BUFFER_MODE,BufferMode.Transient.toString());

            /*
             * If an explicit filename is not specified...
             */
            if(m_properties.get(Options.FILE)==null) {

                /*
                 * Use a temporary file for the test. Such files are always deleted when
                 * the journal is closed or the VM exits.
                 */

                m_properties.setProperty(Options.CREATE_TEMP_FILE,"true");
            
                m_properties.setProperty(Options.DELETE_ON_EXIT,"true");
                
            }
            
        }        
        
        return new Properties(m_properties);
        
    }
 
Example #18
Source File: TestBackupServlet.java    From database with GNU General Public License v2.0 4 votes vote down vote up
static public Test suite() {

		return ProxySuiteHelper.suiteWhenStandalone(
				TestBackupServlet.class, "test_backup01",
				Collections.singleton(BufferMode.DiskRW));
	}
 
Example #19
Source File: CacheConnectionImpl.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/**
     * 
     * Note: A distributed cache fabric could be accessed from any node in a
     * cluster. That means that this could be the {@link Journal} -or- the
     * {@link IndexManager} inside the {@link IDataService} and provides direct
     * access to {@link FusedView}s (aka shards).
     * 
     * @param queryEngine
     *            The {@link QueryEngine}.
     */
    public CacheConnectionImpl(final QueryEngine queryEngine) {

        if (queryEngine == null)
            throw new IllegalArgumentException();

        this.queryEngine = queryEngine;
        
        /*
         * TODO Setup properties from Journal or Federation (mainly the maximum
         * amount of RAM to use, but we can not limit that if we are using this
         * for to store named solution sets rather than as a cache).
         * 
         * TODO Setup an expire thread or a priority heap for expiring named
         * solution sets from the cache.
         */
        final Properties properties = new Properties();

        /*
         * Note: The cache will be backed by ByteBuffer objects allocated on the
         * native process heap (Zero GC).
         */
        properties.setProperty(com.bigdata.journal.Options.BUFFER_MODE,
                BufferMode.MemStore.name());

        // Start small, grow as required.
        properties.setProperty(com.bigdata.journal.Options.INITIAL_EXTENT, ""
                + (1 * Bytes.megabyte));

//        properties.setProperty(com.bigdata.journal.Options.CREATE_TEMP_FILE,
//                "true");
//
////        properties.setProperty(Journal.Options.COLLECT_PLATFORM_STATISTICS,
////                "false");
////
////        properties.setProperty(Journal.Options.COLLECT_QUEUE_STATISTICS,
////                "false");
////
////        properties.setProperty(Journal.Options.HTTPD_PORT, "-1"/* none */);

        if (useMainDatabaseForCache) {
        
            this.cacheStore = (IJournal) queryEngine.getIndexManager();

        } else {
            
            this.cacheStore = new InnerCacheJournal(properties);
            
        }

        /*
         * TODO Hack enables the DESCRIBE cache.
         * 
         * TODO The describe cache can not be local on a federation (or if it
         * is, it has to be local to the query controller).
         */
        this.enableDescribeCache = QueryHints.DEFAULT_DESCRIBE_CACHE
                && queryEngine.getFederation() == null;

    }
 
Example #20
Source File: TestGeoSpatialServiceEvaluationQuads.java    From database with GNU General Public License v2.0 4 votes vote down vote up
@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;

}
 
Example #21
Source File: TestGeoSpatialCorrectRejection.java    From database with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Properties getProperties() {

    // Note: clone to avoid modifying!!!
    final Properties properties = (Properties) super.getProperties().clone();

    // turn on quads.
    properties.setProperty(AbstractTripleStore.Options.QUADS, "false");

    // 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://my.custom.datatype/x-y-z\", "
       + "\"fields\": [ "
       + "{ \"valueType\": \"DOUBLE\", \"multiplier\": \"1000\", \"serviceMapping\": \"x\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"multiplier\": \"1000\", \"serviceMapping\": \"y\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"multiplier\": \"1000\", \"serviceMapping\": \"z\" } "
       + "]}}");

    properties.setProperty(
       com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DATATYPE_CONFIG + ".1",
       "{\"config\": "
       + "{ \"uri\": \"http://my.custom.datatype/time-x-y-z\", "
       + "\"fields\": [ "
       + "{ \"valueType\": \"LONG\", \"minVal\" : \"0\", \"multiplier\": \"1\", \"serviceMapping\": \"TIME\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"multiplier\": \"1000\", \"serviceMapping\": \"x\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"multiplier\": \"1000\", \"serviceMapping\": \"y\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"multiplier\": \"1000\", \"serviceMapping\": \"z\" }"
       + "]}}");

    properties.setProperty(
            com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DATATYPE_CONFIG + ".2",
            "{\"config\": "
            + "{ \"uri\": \"http://my.custom.datatype/x-y-z-lat-lon\", "
            + "\"fields\": [ "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-1000\", \"multiplier\": \"10\", \"serviceMapping\": \"x\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-10\", \"multiplier\": \"100\", \"serviceMapping\": \"y\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-2\", \"multiplier\": \"1000\", \"serviceMapping\": \"z\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"0\", \"multiplier\": \"1000000\", \"serviceMapping\": \"LATITUDE\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"0\", \"multiplier\": \"100000\", \"serviceMapping\": \"LONGITUDE\" } "
            + "]}}");
    
    properties.setProperty(
            com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DATATYPE_CONFIG + ".3",
            "{\"config\": "
            + "{ \"uri\": \"http://my.custom.datatype/x-y-z-lat-lon-time\", "
            + "\"fields\": [ "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-1000\", \"multiplier\": \"10\", \"serviceMapping\": \"x\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-10\", \"multiplier\": \"100\", \"serviceMapping\": \"y\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-2\", \"multiplier\": \"1000\", \"serviceMapping\": \"z\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"0\", \"multiplier\": \"1000000\", \"serviceMapping\": \"LATITUDE\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"0\", \"multiplier\": \"100000\", \"serviceMapping\": \"LONGITUDE\" }, "
            + "{ \"valueType\": \"LONG\", \"minVal\" : \"0\", \"multiplier\": \"1\", \"serviceMapping\": \"TIME\" } "
            + "]}}");
    
    properties.setProperty(
       com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DATATYPE_CONFIG + ".4",
       "{\"config\": "
       + "{ \"uri\": \"http://my.custom.datatype/x-y-z-lat-lon-time-coord\", "
       + "\"fields\": [ "
       + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-1000\", \"multiplier\": \"10\", \"serviceMapping\": \"x\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-10\", \"multiplier\": \"100\", \"serviceMapping\": \"y\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"-2\", \"multiplier\": \"1000\", \"serviceMapping\": \"z\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"0\", \"multiplier\": \"1000000\", \"serviceMapping\": \"LATITUDE\" }, "
       + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"0\", \"multiplier\": \"100000\", \"serviceMapping\": \"LONGITUDE\" }, "
       + "{ \"valueType\": \"LONG\", \"minVal\" : \"0\", \"multiplier\": \"1\", \"serviceMapping\": \"TIME\" }, "
       + "{ \"valueType\": \"LONG\", \"minVal\" : \"0\", \"multiplier\": \"1\", \"serviceMapping\": \"COORD_SYSTEM\" } "
       + "]}}");

    properties.setProperty(
            com.bigdata.rdf.store.AbstractLocalTripleStore.Options.GEO_SPATIAL_DATATYPE_CONFIG + ".5",
            "{\"config\": "
            + "{ \"uri\": \"http://my.custom.datatype/lat-lon\", "
            + "\"fields\": [ "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"0\", \"multiplier\": \"1000000\", \"serviceMapping\": \"LATITUDE\" }, "
            + "{ \"valueType\": \"DOUBLE\", \"minVal\" : \"0\", \"multiplier\": \"100000\", \"serviceMapping\": \"LONGITUDE\" } "
            + "]}}");        
    
    properties.setProperty(
            com.bigdata.rdf.store.AbstractLocalTripleStore.Options.VOCABULARY_CLASS,
            "com.bigdata.rdf.sparql.ast.eval.service.GeoSpatialTestVocabulary");

    return properties;

}
 
Example #22
Source File: TestNanoSparqlServerWithProxyIndexManager.java    From database with GNU General Public License v2.0 4 votes vote down vote up
public static Test suite() {
    return TestNanoSparqlServerWithProxyIndexManager.suite(
            getTemporaryJournal(BufferMode.DiskRW), TestMode.triples);
}
 
Example #23
Source File: Bigdata2ASTSPARQL11SyntaxTest.java    From database with GNU General Public License v2.0 4 votes vote down vote up
protected Properties getProperties() {

        final Properties properties = new Properties();

        // turn on quads.
        properties.setProperty(AbstractTripleStore.Options.QUADS, "true");

//        // 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());

        // Note: No persistence.
        properties.setProperty(com.bigdata.journal.Options.BUFFER_MODE,
                BufferMode.Transient.toString());
        
        return properties;

    }
 
Example #24
Source File: TestNativeDistinctFilter.java    From database with GNU General Public License v2.0 4 votes vote down vote up
public JoinSetup(final String kbNamespace) {

            if (kbNamespace == null)
                throw new IllegalArgumentException();
            
            final Properties properties = new Properties();

            properties.setProperty(Journal.Options.BUFFER_MODE,
                    BufferMode.Transient.toString());
            
            jnl = new Journal(properties);

            // create the kb.
            final AbstractTripleStore kb = new LocalTripleStore(jnl,
                    kbNamespace, ITx.UNISOLATED, properties);

            kb.create();

            this.spoNamespace = kb.getSPORelation().getNamespace();

            // Setup the vocabulary.
            {
                final BigdataValueFactory vf = kb.getValueFactory();
                final String uriString = "http://bigdata.com/";
                final BigdataURI _knows = vf.asValue(FOAFVocabularyDecl.knows);
                final BigdataURI _brad = vf.createURI(uriString+"brad");
                final BigdataURI _john = vf.createURI(uriString+"john");
                final BigdataURI _fred = vf.createURI(uriString+"fred");
                final BigdataURI _mary = vf.createURI(uriString+"mary");
                final BigdataURI _paul = vf.createURI(uriString+"paul");
                final BigdataURI _leon = vf.createURI(uriString+"leon");
                final BigdataURI _luke = vf.createURI(uriString+"luke");

                final BigdataValue[] a = new BigdataValue[] {
                      _knows,//
                      _brad,
                      _john,
                      _fred,
                      _mary,
                      _paul,
                      _leon,
                      _luke
                };

                kb.getLexiconRelation()
                        .addTerms(a, a.length, false/* readOnly */);

                knows = _knows.getIV();
                brad = _brad.getIV();
                john = _john.getIV();
                fred = _fred.getIV();
                mary = _mary.getIV();
                paul = _paul.getIV();
                leon = _leon.getIV();
                luke = _luke.getIV();

            }

//            // data to insert (in key order for convenience).
//            final SPO[] a = {//
//                    new SPO(paul, knows, mary, StatementEnum.Explicit),// [0]
//                    new SPO(paul, knows, brad, StatementEnum.Explicit),// [1]
//                    
//                    new SPO(john, knows, mary, StatementEnum.Explicit),// [2]
//                    new SPO(john, knows, brad, StatementEnum.Explicit),// [3]
//                    
//                    new SPO(mary, knows, brad, StatementEnum.Explicit),// [4]
//                    
//                    new SPO(brad, knows, fred, StatementEnum.Explicit),// [5]
//                    new SPO(brad, knows, leon, StatementEnum.Explicit),// [6]
//            };
//
//            // insert data (the records are not pre-sorted).
//            kb.addStatements(a, a.length);
//
//            // Do commit since not scale-out.
//            jnl.commit();

        }
 
Example #25
Source File: TestRWStoreTxBehaviors.java    From database with GNU General Public License v2.0 4 votes vote down vote up
static public Test suite() {
	return ProxySuiteHelper.suiteWhenStandalone(TestRWStoreTxBehaviors.class,
			"test.*", Collections.singleton(BufferMode.DiskRW), TestMode.triples
			);
}
 
Example #26
Source File: TestIndexSegmentBuilderWithLargeTrees.java    From database with GNU General Public License v2.0 4 votes vote down vote up
public Properties getProperties() {

        if (properties == null) {

            properties = super.getProperties();

            properties.setProperty(Options.BUFFER_MODE, BufferMode.Disk
                    .toString());

            properties.setProperty(Options.CREATE_TEMP_FILE, "true");

            properties.setProperty(Options.DELETE_ON_EXIT, "true");

        }

        return properties;

    }
 
Example #27
Source File: TestIndexSegmentWithBloomFilter.java    From database with GNU General Public License v2.0 4 votes vote down vote up
public Properties getProperties() {

        if (properties == null) {

            properties = super.getProperties();

            properties.setProperty(Options.BUFFER_MODE, BufferMode.Disk
                    .toString());

            properties.setProperty(Options.CREATE_TEMP_FILE, "true");

        }

        return properties;

    }
 
Example #28
Source File: TestMove.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Overridden to specify the {@link BufferMode#Disk} mode and to lower the
     * threshold at which an overflow operation will be selected.
     */
    public Properties getProperties() {
        
        final Properties properties = new Properties(super.getProperties());
        
        // overrides Transient in the base class.
        properties.setProperty(Options.BUFFER_MODE, BufferMode.Disk
                .toString());

        // this test relies on 2 or more data services.
        properties.setProperty(EmbeddedClient.Options.NDATA_SERVICES, "2");

        // Note: disable copy of small index segments to the new journal during overflow.
        properties.setProperty(Options.COPY_INDEX_THRESHOLD,"0");
        
        // set low minimum #of active partitions per data service.
        properties.setProperty(Options.MINIMUM_ACTIVE_INDEX_PARTITIONS,"1");
        
        // enable moves (one per target).
        properties.setProperty(ResourceManager.Options.MAXIMUM_MOVES_PER_TARGET,"1");

        // allow move of shards which would otherwise be split.
        properties.setProperty(ResourceManager.Options.MAXIMUM_MOVE_PERCENT_OF_SPLIT,"2.0");

        // disable the CPU threshold for moves.
        properties.setProperty(ResourceManager.Options.MOVE_PERCENT_CPU_TIME_THRESHOLD,".0");
        
        // disable scatter split
        properties.setProperty(ResourceManager.Options.SCATTER_SPLIT_ENABLED,"false");

        /*
         * Note: Disables the initial round robin policy for the load balancer
         * service so that it will use our fakes scores.
         */
        properties.setProperty(LoadBalancerService.Options.INITIAL_ROUND_ROBIN_UPDATE_COUNT, "0");

        // turn off acceleration features.
        properties.setProperty(Options.ACCELERATE_OVERFLOW_THRESHOLD, "0");
        properties.setProperty(Options.ACCELERATE_SPLIT_THRESHOLD, "0");

        // Note: Set a low maximum shard size.
        properties.setProperty(Options.NOMINAL_SHARD_SIZE, ""+Bytes.megabyte);

//        properties.setProperty(Options.INITIAL_EXTENT, ""+1*Bytes.megabyte);
        
//        properties.setProperty(Options.MAXIMUM_EXTENT, ""+1*Bytes.megabyte);
        
        return properties;
        
    }
 
Example #29
Source File: TestScatterSplit.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Overridden to specify the {@link BufferMode#Disk} mode and to lower the
     * threshold at which an overflow operation will be selected.
     */
    public Properties getProperties() {
        
        final Properties properties = new Properties(super.getProperties());
        
        // overrides Transient in the base class.
        properties.setProperty(Options.BUFFER_MODE, BufferMode.Disk
                .toString());

        // this test relies on 2 or more data services.
        properties.setProperty(EmbeddedClient.Options.NDATA_SERVICES, "2");

        // Note: disable copy of small index segments to the new journal during overflow.
        properties.setProperty(Options.COPY_INDEX_THRESHOLD,"0");
        
//        // set low minimum #of active partitions per data service.
//        properties.setProperty(Options.MINIMUM_ACTIVE_INDEX_PARTITIONS,"1");
        
//        // enable moves (one per target).
//        properties.setProperty(ResourceManager.Options.MAXIMUM_MOVES_PER_TARGET,"1");
//
//        // allow move of shards which would otherwise be split.
//        properties.setProperty(ResourceManager.Options.MAXIMUM_MOVE_PERCENT_OF_SPLIT,"2.0");
//
//        // disable the CPU threshold for moves.
//        properties.setProperty(ResourceManager.Options.MOVE_PERCENT_CPU_TIME_THRESHOLD,".0");
        
        // enable scatter splits
        properties.setProperty(ResourceManager.Options.SCATTER_SPLIT_ENABLED,"true");

//        /*
//         * Note: Disables the initial round robin policy for the load balancer
//         * service so that it will use our fakes scores.
//         */
//        properties.setProperty(LoadBalancerService.Options.INITIAL_ROUND_ROBIN_UPDATE_COUNT, "0");

        // turn off acceleration features.
        properties.setProperty(Options.ACCELERATE_OVERFLOW_THRESHOLD, "0");
        properties.setProperty(Options.ACCELERATE_SPLIT_THRESHOLD, "0");

        // Note: Set a low maximum shard size.
        properties.setProperty(Options.NOMINAL_SHARD_SIZE, ""+Bytes.megabyte);

//        properties.setProperty(Options.INITIAL_EXTENT, ""+1*Bytes.megabyte);
        
//        properties.setProperty(Options.MAXIMUM_EXTENT, ""+1*Bytes.megabyte);
        
        return properties;
        
    }
 
Example #30
Source File: HelloBlazegraph.java    From blazegraph-samples with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws OpenRDFException {

		final Properties props = new Properties();
		
		/*
		 * For more configuration parameters see
		 * http://www.blazegraph.com/docs/api/index.html?com/bigdata/journal/BufferMode.html
		 */
		props.put(Options.BUFFER_MODE, BufferMode.DiskRW); // persistent file system located journal
		props.put(Options.FILE, "/tmp/blazegraph/test.jnl"); // journal file location

		final BigdataSail sail = new BigdataSail(props); // instantiate a sail
		final Repository repo = new BigdataSailRepository(sail); // create a Sesame repository

		repo.initialize();

		try {
			// prepare a statement
			final URIImpl subject = new URIImpl("http://blazegraph.com/Blazegraph");
			final URIImpl predicate = new URIImpl("http://blazegraph.com/says");
			final Literal object = new LiteralImpl("hello");
			final Statement stmt = new StatementImpl(subject, predicate, object);

			// open repository connection
			RepositoryConnection cxn = repo.getConnection();

			// upload data to repository
			try {
				cxn.begin();
				cxn.add(stmt);
				cxn.commit();
			} catch (OpenRDFException ex) {
				cxn.rollback();
				throw ex;
			} finally {
				// close the repository connection
				cxn.close();
			}

			// open connection
			if (repo instanceof BigdataSailRepository) {
				cxn = ((BigdataSailRepository) repo).getReadOnlyConnection();
			} else {
				cxn = repo.getConnection();
			}

			// evaluate sparql query
			try {

				final TupleQuery tupleQuery = cxn
						.prepareTupleQuery(QueryLanguage.SPARQL,
								"select ?p ?o where { <http://blazegraph.com/Blazegraph> ?p ?o . }");
				final TupleQueryResult result = tupleQuery.evaluate();
				try {
					while (result.hasNext()) {
						final BindingSet bindingSet = result.next();
						System.err.println(bindingSet);
					}
				} finally {
					result.close();
				}

			} finally {
				// close the repository connection
				cxn.close();
			}

		} finally {
			repo.shutDown();
		}
	}