当前位置: 首页>>代码示例>>Java>>正文


Java MemoryStore类代码示例

本文整理汇总了Java中org.eclipse.rdf4j.sail.memory.MemoryStore的典型用法代码示例。如果您正苦于以下问题:Java MemoryStore类的具体用法?Java MemoryStore怎么用?Java MemoryStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MemoryStore类属于org.eclipse.rdf4j.sail.memory包,在下文中一共展示了MemoryStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createLdpath

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
private LDPath<Value> createLdpath(Model model) {
  Repository repository = new SailRepository(new MemoryStore());
  Rdf4jRepositoryBackend repositoryBackend;

  try {
    repository.initialize();
    repositoryBackend = new Rdf4jRepositoryBackend(repository);

    final RepositoryConnection connection = repository.getConnection();
    connection.add(model);
    connection.close();
  } catch (RepositoryException re) {
    throw new LdPathExecutorRuntimeException("Unable to initialize RDF4JRepository.", re);
  }

  LDPath<Value> result = new LDPath<>(repositoryBackend, LD_PATH_CONFIG);

  result.registerFunction(new SortByPropertyFunction<>(ldpathNamespaces));

  return result;
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:22,代码来源:LdPathExecutor.java

示例2: init

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
/**
 * Initialize repository and load triples
 * 
 * @throws IOException 
 */
public void init() throws IOException {
    LOG.debug("Initialize repository");
    repo = new SailRepository(new MemoryStore());
    repo.initialize();
    
    Optional<RDFFormat> fmt = Rio.getParserFormatForFileName(path.toString());
    if (!fmt.isPresent()) {
        throw new IOException("Could not determine file type");
    }
    
    LOG.debug("Adding triples");
    BufferedReader r = Files.newBufferedReader(path);
    
    Date start = new Date();
    RepositoryConnection con = repo.getConnection();
    try {
        con.add(r, BASE_URI, fmt.get());
    } catch (RepositoryException cve) {
        LOG.error("Error adding triples", cve);
    }
    LOG.info("{} triples loaded in {} ms", 
            con.size(), new Date().getTime() - start.getTime());
            
    if(con.isEmpty()) {
        LOG.error("No statements loaded");
        close();
    }
}
 
开发者ID:Fedict,项目名称:rdfvalidator,代码行数:34,代码来源:Validator.java

示例3: configurationBackend

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Bean
public ConfigurationBackend configurationBackend(
    @Value("classpath:/model/elmo.trig") Resource elmoConfiguration,
    @Value("#{applicationProperties.resourcePath}") String resourcePath,
    @Value("classpath:/model/elmo-shapes.trig") Resource elmoShapes,
    ShaclValidator shaclValidator) {
  return new FileConfigurationBackend(elmoConfiguration, new SailRepository(new MemoryStore()),
      resourcePath, elmoShapes, shaclValidator);
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:10,代码来源:ApplicationConfiguration.java

示例4: repository

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Bean(name="repository", initMethod = "initialize",
        destroyMethod = "shutDown")
public Repository repository(final Environment env)
        throws RepositoryException, IOException, RDFParseException {
    // For tets we use only in memory
    Sail store = new MemoryStore();
    return new SailRepository(store);
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:9,代码来源:RestApiTestContext.java

示例5: createInMemoryRepository

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
/**
 * Creates a local in-memory Sesame repository which is disposed when the VM shuts down.
 */
private Repository createInMemoryRepository(Configuration configuration) {
    LOG.trace("Creating local in-memory repository.");
    final MemoryStore ms = new MemoryStore();
    if (configuration.is(SesameConfigParam.USE_INFERENCE)) {
        return new SailRepository(new ForwardChainingRDFSInferencer(ms));
    } else {
        return new SailRepository(ms);
    }
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:13,代码来源:StorageConnector.java

示例6: Storage

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
/**
 * RDF store
 * 
 * @param f file to be used as storage
 */
public Storage(File f) {
    logger.info("Opening RDF store " + f.getAbsolutePath());
    
    MemoryStore mem = new MemoryStore(f);
    mem.setPersist(false);
    repo = new SailRepository(mem);
}
 
开发者ID:Fedict,项目名称:dcattools,代码行数:13,代码来源:Storage.java

示例7: main

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
/**
   * Main program
   * 
   * @param args 
   */
  public static void main(String[] args)  {
      logger.info("-- START --");
      if (args.length < 2) {
          logger.error("No input or output file");
          System.exit(-1);
      }
      
      Optional<RDFFormat> fmtin = Rio.getParserFormatForFileName(args[0]);
      if(!fmtin.isPresent()) {
          logger.error("No parser for input {}", args[0]);
          System.exit(-2);
      }
      
      int code = 0;
      Repository repo = new SailRepository(new MemoryStore());
repo.initialize();

Serializer s = getSerializer();		
s.setOutputFile(new File(args[1]));
	
      try (RepositoryConnection con = repo.getConnection()) {
          con.add(new File(args[0]), "http://data.gov.be", fmtin.get());
	
	XMLStreamWriter w = s.getXMLStreamWriter();

	w.writeStartDocument();
	writeCatalog(w, con);
	w.writeEndDocument();
	
	w.close();		
} catch (IOException|XMLStreamException|SaxonApiException ex) {
          logger.error("Error converting", ex);
          System.exit(-1);
      } finally {
	repo.shutDown();
}
  }
 
开发者ID:Fedict,项目名称:dcattools,代码行数:43,代码来源:EDP.java

示例8: createGraph

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Override
public RDF4JGraph createGraph() {
    final Sail sail = new MemoryStore();
    final Repository repository = new SailRepository(sail);
    repository.initialize();
    return rdf4jFactory.asGraph(repository);
}
 
开发者ID:apache,项目名称:commons-rdf,代码行数:8,代码来源:MemoryGraphTest.java

示例9: testRemoveAll

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Override
@Test
public void testRemoveAll() throws Exception {
	Repository repo = new SailRepository(new MemoryStore());
	repo.initialize();
	RepositoryModelSet modelSet = new RepositoryModelSet(repo);
	modelSet.open();
	URI context1 = new URIImpl("uri:context1");
	URI context2 = new URIImpl("uri:context2");
	modelSet.addStatement(context1, new URIImpl("uri:r1"), new URIImpl(
			"uri:p1"), new URIImpl("uri:r2"));
	modelSet.addStatement(context1, new URIImpl("uri:r1"), new URIImpl(
			"uri:p1"), new URIImpl("uri:r3"));
	modelSet.addStatement(context2, new URIImpl("uri:r4"), new URIImpl(
			"uri:p2"), new URIImpl("uri:r5"));
	modelSet.addStatement(context2, new URIImpl("uri:r4"), new URIImpl(
			"uri:p2"), new URIImpl("uri:r6"));
	Model model1 = modelSet.getModel(context1);
	model1.open();
	Model model2 = modelSet.getModel(context2);
	model2.open();
	assertEquals(4, modelSet.size());
	assertEquals(2, model1.size());
	assertEquals(2, model2.size());

	model2.removeAll();

	assertEquals(2, modelSet.size());
	assertEquals(2, model1.size());
	assertEquals(0, model2.size());
	model1.close();
	model2.close();
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:34,代码来源:RepositoryModelTest.java

示例10: createRepository

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
public static Repository createRepository(Collection<Statement> statements) throws RepositoryException {
    Repository repository = new SailRepository(new MemoryStore());
    repository.initialize();
    RepositoryConnection connection = repository.getConnection();
    connection.add(statements);
    connection.close();
    return repository;
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:9,代码来源:FTDPUTestUtils.java

示例11: before

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Before
public void before() {
  repository = new SailRepository(new MemoryStore());
  repository.initialize();
  backend = new Rdf4jRepositoryBackend(repository);
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:7,代码来源:AbstractFunctionTest.java

示例12: initVars

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Before
public void initVars() {
  elmoConfiguration = new ClassPathResource("/model/elmo.trig");
  elmoShapes = new ClassPathResource("/model/elmo-shapes.trig");
  sailRepository = new SailRepository(new MemoryStore());
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:7,代码来源:FileConfigurationBackendPrefixesIntegrationTest.java

示例13: initVars

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Before
public void initVars() throws IOException {
  elmoConfiguration = new ClassPathResource("/model/elmo.trig");
  elmoShapes = new ClassPathResource("/model/elmo-shapes.trig");
  sailRepository = new SailRepository(new MemoryStore());
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:7,代码来源:FileConfigurationBackendIntegrationTest.java

示例14: testWriteAndFind

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Test
public void testWriteAndFind() throws Exception {
    Repository repo = new SailRepository(new MemoryStore());
    repo.initialize();

    try (RepositoryConnection connection = repo.getConnection()) {

        ValueFactory vf = SimpleValueFactory.getInstance();

        String ex = "http://example.org/";

        IRI lilie = vf.createIRI(ex, "Lilie");

        connection.add(lilie, FOAF.NAME, vf.createLiteral("Lilie"));
        connection.add(lilie, FOAF.MBOX, vf.createIRI("mailto:[email protected]"));
        connection.add(lilie, FOAF.KNOWS, vf.createIRI(ex, "Bob"));

        boolean hasStatement = connection.hasStatement(vf.createIRI(ex, "Lilie"), null, null, false);
        assertTrue(hasStatement);

        RepositoryResult<Statement> statements = connection.getStatements(vf.createIRI(ex, "Lilie"), FOAF.NAME, null);

        assertEquals("Lilie", statements.next().getObject().stringValue());
    }

}
 
开发者ID:bpark,项目名称:chlorophytum-semantics,代码行数:27,代码来源:RdfStoreTest.java

示例15: setUp

import org.eclipse.rdf4j.sail.memory.MemoryStore; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    this.store = new SailRepository(new MemoryStore());
    store.initialize();
}
 
开发者ID:kbss-cvut,项目名称:reporting-tool,代码行数:6,代码来源:DataDaoTest.java


注:本文中的org.eclipse.rdf4j.sail.memory.MemoryStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。