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


Java SimpleValueFactory.createIRI方法代码示例

本文整理汇总了Java中org.eclipse.rdf4j.model.impl.SimpleValueFactory.createIRI方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleValueFactory.createIRI方法的具体用法?Java SimpleValueFactory.createIRI怎么用?Java SimpleValueFactory.createIRI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.rdf4j.model.impl.SimpleValueFactory的用法示例。


在下文中一共展示了SimpleValueFactory.createIRI方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: map_withClasses_appliesEveryClassToGeneratedSubject

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Test
public void map_withClasses_appliesEveryClassToGeneratedSubject() throws Exception {

	EvaluateExpression evaluator = null;
	SimpleValueFactory f = SimpleValueFactory.getInstance();
	IRI subjectIRI = f.createIRI("http://foo.bar/subjectIRI");

	when(subjectGenerator.apply(evaluator))
			.thenReturn(Optional.of(subjectIRI));

	Set<IRI> expectedClasses = 
		ImmutableSet.of(
			f.createIRI("http://www.none.invalid/foo"),
			f.createIRI("http://www.none.invalid/bar"),
			f.createIRI("http://www.none.invalid/baz")
		);

	Model model = new ModelBuilder().build();
	SubjectMapper s = new SubjectMapper(subjectGenerator, ImmutableSet.of(), expectedClasses, ImmutableSet.of());
	s.map(model, evaluator);

	expectedClasses.forEach(iri -> Assert.assertTrue(model.contains(subjectIRI, RDF.TYPE, iri)));
}
 
开发者ID:carml,项目名称:carml,代码行数:24,代码来源:SubjectMapperTest.java

示例2: map_withPredicateMappers_callsEachPredicateMapper

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Test
public void map_withPredicateMappers_callsEachPredicateMapper() throws Exception {
	SimpleValueFactory f = SimpleValueFactory.getInstance();
	IRI subjectIRI = f.createIRI("http://foo.bar/subjectIRI");

	Set<PredicateMapper> predicateMappers = ImmutableSet.of(
			mock(PredicateMapper.class),
			mock(PredicateMapper.class),
			mock(PredicateMapper.class),
			mock(PredicateMapper.class)
	);

	Model model = new ModelBuilder().build();
	EvaluateExpression evaluator = null;


	PredicateObjectMapper testSubject = new PredicateObjectMapper(ImmutableSet.of(), predicateMappers);
	testSubject.map(model, evaluator, subjectIRI, ImmutableSet.of());

	predicateMappers.forEach(mapper -> verify(mapper).map(model, evaluator, subjectIRI));
}
 
开发者ID:carml,项目名称:carml,代码行数:22,代码来源:PredicateObjectMapperTest.java

示例3: setUp

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Before
public void setUp() {
  SimpleValueFactory valueFactory = SimpleValueFactory.getInstance();

  parameter = new StringTermParameter(valueFactory.createIRI("http://parameter-iri"),
      "parameter-name", true);
  parameter2 = new StringTermParameter(valueFactory.createIRI("http://parameter2-iri"),
      "parameter2-name", true);

  product = new TestInformationProduct(DBEERPEDIA.ORIGIN_INFORMATION_PRODUCT,
      DBEERPEDIA.BREWERIES_LABEL.stringValue(), ResultType.GRAPH,
      ImmutableList.of(parameter, parameter2), templateProcessorMock);

  mapper = new RequestParameterMapper();

  requestParameters = new RequestParameters();
  MultivaluedMap<String, String> mvMap = new MultivaluedHashMap<>();
  mvMap.put("param1", ImmutableList.of("value", "valueB"));
  mvMap.put("param2", ImmutableList.of("value2"));
  requestParameters.putAll(mvMap);
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:22,代码来源:RequestParameterMapperTest.java

示例4: setUp

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Before
public void setUp() {
  // Arrange
  SimpleValueFactory valueFactory = SimpleValueFactory.getInstance();

  requiredParameter = new StringTermParameter(
      valueFactory.createIRI("http://required-parameter-iri"), "required-parameter-name", true);
  optionalParameter = new StringTermParameter(
      valueFactory.createIRI("http://optional-parameter-iri"), "optional-parameter-name", false);

  product = new TestInformationProduct(DBEERPEDIA.ORIGIN_INFORMATION_PRODUCT,
      DBEERPEDIA.BREWERIES_LABEL.stringValue(), ResultType.GRAPH,
      ImmutableList.of(requiredParameter, optionalParameter), templateProcessorMock);

  representationRequestParameterMapper = new RepresentationRequestParameterMapper();

  uriInfoMock = mock(UriInfo.class);
  when(contextMock.getUriInfo()).thenReturn(uriInfoMock);

}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:21,代码来源:RepresentationRequestParameterMapperTest.java

示例5: map_withPredicateObjectMappers_callsEveryPredicateObjectMapper

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Test
public void map_withPredicateObjectMappers_callsEveryPredicateObjectMapper() throws Exception {

	EvaluateExpression evaluator = null;

	SimpleValueFactory f = SimpleValueFactory.getInstance();
	IRI subjectIRI = f.createIRI("http://foo.bar/subjectIRI");

	when(subjectGenerator.apply(evaluator))
			.thenReturn(Optional.of(subjectIRI));

	PredicateObjectMapper mockMapper1 = mock(PredicateObjectMapper.class);
	PredicateObjectMapper mockMapper2 = mock(PredicateObjectMapper.class);
	PredicateObjectMapper mockMapper3 = mock(PredicateObjectMapper.class);
	PredicateObjectMapper mockMapper4 = mock(PredicateObjectMapper.class);
	Set<PredicateObjectMapper> predObjMappers = 
		ImmutableSet.of(mockMapper1, mockMapper2, mockMapper3, mockMapper4);

	Model model = new ModelBuilder().build();
	SubjectMapper s = 
		new SubjectMapper(subjectGenerator, ImmutableSet.of(), ImmutableSet.of(), predObjMappers);
	
	s.map(model, evaluator);

	predObjMappers.forEach(
		mapper -> 
			verify(mapper)
			.map(model, evaluator, subjectIRI, ImmutableSet.of()));
}
 
开发者ID:carml,项目名称:carml,代码行数:30,代码来源:SubjectMapperTest.java

示例6: map_withPassedAndOwnGraphs_removesDuplicatesFromConcatenatedContext

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Test
public void map_withPassedAndOwnGraphs_removesDuplicatesFromConcatenatedContext() throws Exception {
	SimpleValueFactory f = SimpleValueFactory.getInstance();
	IRI subjectIRI = f.createIRI("http://foo.bar/subjectIRI");

	PredicateMapper childMapper = mock(PredicateMapper.class);

	Model model = new ModelBuilder().build();
	EvaluateExpression evaluator = null;

	IRI subjectGraphIri = f.createIRI("http://subject.context/graph");
	IRI ownGraphIri = f.createIRI("http://own.context/graph");

	Set<IRI> subjectContext = ImmutableSet.of(subjectGraphIri, ownGraphIri, ownGraphIri, subjectGraphIri);
	Set<IRI> ownContext = ImmutableSet.of(ownGraphIri, subjectGraphIri, subjectGraphIri, ownGraphIri);
	IRI[] expectedContext = new IRI[] { subjectGraphIri, ownGraphIri };

	Set<TermGenerator<IRI>> ownGraphGenerators = ownContext.stream()
			.map(graphIri -> {
				@SuppressWarnings("unchecked")
				TermGenerator<IRI> generator = (TermGenerator<IRI>) mock(TermGenerator.class);
				when(generator.apply(evaluator)).thenReturn(Optional.of(graphIri)).getMock();
				return generator;
			})
			.collect(ImmutableCollectors.toImmutableSet());


	PredicateObjectMapper testSubject = new PredicateObjectMapper(ownGraphGenerators, ImmutableSet.of(childMapper));
	testSubject.map(model, evaluator, subjectIRI, subjectContext);

	verify(childMapper).map(model, evaluator, subjectIRI, expectedContext);

}
 
开发者ID:carml,项目名称:carml,代码行数:34,代码来源:PredicateObjectMapperTest.java

示例7: setUp

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Before
public void setUp() {
  SimpleValueFactory valueFactory = SimpleValueFactory.getInstance();

  requiredParameter1 = new StringTermParameter(valueFactory.createIRI("http://foo#", "required1"),
      "nameOfRequired1", true);
  requiredParameter2 = new StringTermParameter(valueFactory.createIRI("http://foo#", "required2"),
      "nameOfRequired2", true);
  optionalParameter1 = new StringTermParameter(valueFactory.createIRI("http://foo#", "optional1"),
      "nameOfOptional1", false);
  optionalParameter2 = new StringTermParameter(valueFactory.createIRI("http://foo#", "optional2"),
      "nameOfOptional2", false);
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:14,代码来源:SparqlBackendInformationProductTest.java

示例8: map_withGraphsAndClasses_appliesGraphsToEveryClass

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Test
public void map_withGraphsAndClasses_appliesGraphsToEveryClass() throws Exception {

	EvaluateExpression evaluator = null;

	SimpleValueFactory f = SimpleValueFactory.getInstance();
	IRI subjectIRI = f.createIRI("http://foo.bar/subjectIRI");

	when(subjectGenerator.apply(evaluator))
			.thenReturn(Optional.of(subjectIRI));


	Set<IRI> graphs = 
		ImmutableSet.of(
			f.createIRI("http://www.none.invalid/graph1"),
			f.createIRI("http://www.none.invalid/graph2"),
			f.createIRI("http://www.none.invalid/graph3"),
			f.createIRI("http://www.none.invalid/graph4")
		);
	Set<TermGenerator<IRI>> graphGenerators = 
		graphs.stream()
			.map(graphIri -> {
				@SuppressWarnings("unchecked")
				TermGenerator<IRI> generator = (TermGenerator<IRI>) mock(TermGenerator.class);
				when(generator.apply(evaluator)).thenReturn(Optional.of(graphIri));
				return generator;
			})
			.collect(ImmutableCollectors.toImmutableSet());


	Set<IRI> expectedClasses = 
		ImmutableSet.of(
			f.createIRI("http://www.none.invalid/foo"),
			f.createIRI("http://www.none.invalid/bar"),
			f.createIRI("http://www.none.invalid/baz")
		);


	Model model = new ModelBuilder().build();
	SubjectMapper s = new SubjectMapper(subjectGenerator, graphGenerators, expectedClasses, ImmutableSet.of());
	s.map(model, evaluator);

	expectedClasses.forEach(iri ->
		graphs.forEach(graph ->
				Assert.assertTrue(model.contains(subjectIRI, RDF.TYPE, iri, graph)))
	);
}
 
开发者ID:carml,项目名称:carml,代码行数:48,代码来源:SubjectMapperTest.java

示例9: map_withGraphsAndClasses_appliesAllGraphsToEveryPredicateObjectMapper

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Test
public void map_withGraphsAndClasses_appliesAllGraphsToEveryPredicateObjectMapper() throws Exception {
	SimpleValueFactory f = SimpleValueFactory.getInstance();
	IRI subjectIRI = f.createIRI("http://foo.bar/subjectIRI");

	EvaluateExpression evaluator = null;

	Set<IRI> graphs = 
		ImmutableSet.of(
			f.createIRI("http://www.none.invalid/graph1"),
			f.createIRI("http://www.none.invalid/graph2"),
			f.createIRI("http://www.none.invalid/graph3"),
			f.createIRI("http://www.none.invalid/graph4")
		);
	Set<TermGenerator<IRI>> graphGenerators =
		graphs.stream()
			.map(graphIri -> {
				@SuppressWarnings("unchecked")
				TermGenerator<IRI> generator = (TermGenerator<IRI>) mock(TermGenerator.class);
				when(generator.apply(evaluator)).thenReturn(Optional.of(graphIri));
				return generator;
			})
			.collect(ImmutableCollectors.toImmutableSet());


	when(subjectGenerator.apply(evaluator))
			.thenReturn(Optional.of(subjectIRI));

	PredicateObjectMapper mockMapper1 = mock(PredicateObjectMapper.class);
	PredicateObjectMapper mockMapper2 = mock(PredicateObjectMapper.class);
	PredicateObjectMapper mockMapper3 = mock(PredicateObjectMapper.class);
	PredicateObjectMapper mockMapper4 = mock(PredicateObjectMapper.class);
	Set<PredicateObjectMapper> predObjMappers = 
		ImmutableSet.of(mockMapper1, mockMapper2, mockMapper3, mockMapper4);

	Model m = new ModelBuilder().build();
	SubjectMapper s = new SubjectMapper(subjectGenerator, graphGenerators, ImmutableSet.of(), predObjMappers);
	s.map(m, evaluator);

	predObjMappers.forEach(mapper -> verify(mapper).map(m, evaluator, subjectIRI, graphs));
}
 
开发者ID:carml,项目名称:carml,代码行数:42,代码来源:SubjectMapperTest.java

示例10: map_withPassedAndOwnGraphs_createsContextWithOwnAndPassedGraphs

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
@Test
public void map_withPassedAndOwnGraphs_createsContextWithOwnAndPassedGraphs() throws Exception {
	SimpleValueFactory f = SimpleValueFactory.getInstance();
	IRI subjectIRI = f.createIRI("http://foo.bar/subjectIRI");

	PredicateMapper childMapper = mock(PredicateMapper.class);

	Model model = new ModelBuilder().build();
	EvaluateExpression evaluator = null;

	Set<IRI> subjectContext = ImmutableSet.of(
			f.createIRI("http://subject.context/graph1"),
			f.createIRI("http://subject.context/graph2"),
			f.createIRI("http://subject.context/graph3"),
			f.createIRI("http://subject.context/graph4")
	);
	Set<IRI> ownContext = ImmutableSet.of(
			f.createIRI("http://own.context/graph1"),
			f.createIRI("http://own.context/graph2"),
			f.createIRI("http://own.context/graph3"),
			f.createIRI("http://own.context/graph4"));
	IRI[] expectedContext =
			Stream.concat(subjectContext.stream(), ownContext.stream())
					.toArray(IRI[]::new);

	Set<TermGenerator<IRI>> ownGraphGenerators = ownContext.stream()
			.map(graphIri -> {
				@SuppressWarnings("unchecked")
				TermGenerator<IRI> generator = (TermGenerator<IRI>) mock(TermGenerator.class);
				when(generator.apply(evaluator)).thenReturn(Optional.of(graphIri)).getMock();
				return generator;
			})
			.collect(ImmutableCollectors.toImmutableSet());


	PredicateObjectMapper testSubject = new PredicateObjectMapper(ownGraphGenerators, ImmutableSet.of(childMapper));
	testSubject.map(model, evaluator, subjectIRI, subjectContext);

	verify(childMapper).map(model, evaluator, subjectIRI, expectedContext);

}
 
开发者ID:carml,项目名称:carml,代码行数:42,代码来源:PredicateObjectMapperTest.java

示例11: entitiesFor

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
private List<Entity> entitiesFor(String identifier) {
    SimpleValueFactory vf = SimpleValueFactory.getInstance();

    Collection<Statement> statements = asList(
            vf.createStatement(
                    vf.createIRI("http://" + identifier),
                    vf.createIRI("http://predicate/a"),
                    vf.createLiteral("object value a")
            ),
            vf.createStatement(
                    vf.createIRI("http://" + identifier),
                    vf.createIRI("http://predicate/b"),
                    vf.createLiteral("object value b")
            ),
            vf.createStatement(
                    vf.createIRI("http://" + identifier),
                    vf.createIRI("http://predicate/c"),
                    vf.createLiteral("object value c")
            )
    );
    Resource[] graphs = new Resource[]{vf.createIRI("http://foo/graph/" + identifier)};
    Entity entity = new Entity(statements, graphs);


    Collection<Statement> graphStatements = asList(
            vf.createStatement(
                    vf.createIRI("http://foo/graph/" + identifier),
                    vf.createIRI("http://graph/timestamp"),
                    vf.createLiteral(System.currentTimeMillis())
            ),
            vf.createStatement(
                    vf.createIRI("http://foo/graph/" + identifier),
                    vf.createIRI("http://graph/version"),
                    vf.createLiteral("the graph version")
            )
    );
    Resource[] graphContext = new Resource[]{vf.createIRI("http://graph/meta")};
    Entity entity1 = new Entity(graphStatements, graphContext);

    return asList(entity, entity1);
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:42,代码来源:MultiThreadedPersistenceTest.java

示例12: EntityModelWriter

import org.eclipse.rdf4j.model.impl.SimpleValueFactory; //导入方法依赖的package包/类
public EntityModelWriter(TagService<LabeledResource, LabeledResource> tagService, SimpleValueFactory valueFactory)
{
	this.valueFactory = requireNonNull(valueFactory);
	this.tagService = requireNonNull(tagService);
	this.rdfTypePredicate = valueFactory.createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:7,代码来源:EntityModelWriter.java


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