本文整理汇总了Java中org.eclipse.rdf4j.repository.Repository.getValueFactory方法的典型用法代码示例。如果您正苦于以下问题:Java Repository.getValueFactory方法的具体用法?Java Repository.getValueFactory怎么用?Java Repository.getValueFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.rdf4j.repository.Repository
的用法示例。
在下文中一共展示了Repository.getValueFactory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
this.connector = repositoryProvider.createConnector(false);
final Repository repository = connector.unwrap(Repository.class);
this.axiomLoader = new AxiomLoader(connector, repository.getValueFactory(), "en");
this.generatedData = Generator.initTestData(repository);
this.vf = connector.unwrap(Repository.class).getValueFactory();
}
示例2: AbstractRepositoryGraphLike
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
AbstractRepositoryGraphLike(final Repository repository, final UUID salt, final boolean handleInitAndShutdown,
final boolean includeInferred) {
this.repository = repository;
this.salt = salt;
this.includeInferred = includeInferred;
this.handleInitAndShutdown = handleInitAndShutdown;
if (handleInitAndShutdown && !repository.isInitialized()) {
repository.initialize();
}
rdf4jTermFactory = new RDF4J(repository.getValueFactory(), salt);
}
示例3: init
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
private void init(Repository repository) {
this.repository = repository;
this.valueFactory = repository.getValueFactory();
}
示例4: testDirectRepositoryAccess
import org.eclipse.rdf4j.repository.Repository; //导入方法依赖的package包/类
@Test
public void testDirectRepositoryAccess() throws Exception {
Model model = getModelFactory().createModel();
model.open();
// fetch the Repository, a Connection and a ValueFactory
Repository repository = (Repository) model
.getUnderlyingModelImplementation();
RepositoryConnection connection = repository.getConnection();
ValueFactory factory = repository.getValueFactory();
// add a statement
model.addStatement(subject, predicate, object);
// convert the statement parts to RDF4J data types
Resource targetSubject = ConversionUtil.toRDF4J(subject, factory);
IRI targetPredicate = ConversionUtil.toRDF4J(predicate, factory);
Value targetObject = ConversionUtil.toRDF4J(object, factory);
IRI context = RepositoryModel.DEFAULT_RDF4J_CONTEXT;
// make sure this statement is contained in this model
assertTrue(connection.hasStatement(targetSubject, targetPredicate,
targetObject, false, context));
// make sure this statement can also be found through the Model API
ClosableIterator<? extends Statement> sit = model.findStatements(
subject, predicate, object);
assertNotNull(sit);
assertTrue(sit.hasNext());
Statement s2 = sit.next();
URI s2s = (URI) s2.getSubject();
URI s2p = s2.getPredicate();
URI s2o = (URI) s2.getObject();
assertEquals(subject, s2s);
assertEquals(predicate, s2p);
assertEquals(object, s2o);
// make sure that this statement is only returned once
assertFalse(sit.hasNext());
// clean-up
sit.close();
connection.close();
model.close();
}