Package com.clarkparsia.empire.ds

Examples of com.clarkparsia.empire.ds.DataSource


          }
        }
      }
    }

    DataSource aSource = new JenaDataSource(aModel);

    //mSourceCache.put(theMap.get("files").toString(), aSource);

    return aSource;
  }
View Full Code Here


   * @inheritDoc
   */
    @Override
  public DataSource create(final Map<String, Object> theMap) throws DataSourceException {
   
    DataSource aSource = null;
    Model aModel = createModel(theMap);
   
    if (aModel != null) {

      if (LOGGER.isDebugEnabled()) {
View Full Code Here

    try {
      Map<String, Object> aConfig = new HashMap<String, Object>(mConfig);

      aConfig.putAll(theMap);

      DataSource aSource = mDataSourceFactoryProvider.create(aConfig);

      if (!(aSource instanceof MutableDataSource)) {
        throw new IllegalArgumentException("Cannot use Empire with a non-mutable Data source");
      }

      if (isUseEmpireTransactions() && !(aSource instanceof SupportsTransactions)) {
        aSource = new TransactionalDataSource((MutableDataSource) aSource);
      }
     
      aSource.connect();

      return new EntityManagerImpl( (MutableDataSource) aSource);
    }
    catch (ConnectException e) {
      throw new IllegalStateException("Could not connect to the data source", e);
View Full Code Here

    start = System.currentTimeMillis();
   
    String aQueryStr = null;

    try {
      DataSource aSource = (DataSource) theManager.getDelegate();

      start = System.currentTimeMillis();
     
      if (aSource.getQueryFactory().getDialect() instanceof SPARQLDialect) {
        aQueryStr = new SPARQLQueryRenderer().render(aQuery.query());
      }
      else if (aSource.getQueryFactory().getDialect() instanceof SerqlDialect) {
        aQueryStr = new SeRQLQueryRenderer().render(aQuery.query());
      }

      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Got query string in {} ms ", (System.currentTimeMillis() - start));
View Full Code Here

    @Test
    public void testDS() throws Exception{
        Map<String, Object> aMap = Maps.newHashMap();
        aMap.put("factory", "sesame");

        DataSource aSesameSource = Empire.get().persistenceProvider().createDataSource("test-sesame", aMap);

        TripleSource aTripleSrc = DataSourceUtil.asTripleSource(aSesameSource);

        // Sesame sources are triple sources
        assertTrue(aSesameSource == aTripleSrc);
View Full Code Here

          throw new DataSourceException("Error reading file: " + aFile, e);
        }
      }
    }

    DataSource aSource = new MutableTestDataSource(aRepo);

        if (theMap.containsKey("files")) {
        mSourceCache.put(theMap.get("files").toString(), aSource);
        }
View Full Code Here

public class TestDS {
  @Test
  public void testTripleSourceCreate() throws DataSourceException {
    Empire.init(new DefaultEmpireModule(), new TestModule());
   
    DataSource aTestSource = TestUtil.createTestSource();

    // this is a test source, so it should not be a TripleSource...

    assertFalse(aTestSource instanceof TripleSource);
View Full Code Here

TOP

Related Classes of com.clarkparsia.empire.ds.DataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.