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


Java LinkedHashModel类代码示例

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


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

示例1: build_CreatesRepresentation_WithCompleteData

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Test
public void build_CreatesRepresentation_WithCompleteData() {
  // Act
  final Stage stage = new Stage.Builder(DBEERPEDIA.BREWERIES, site).basePath(
      DBEERPEDIA.BASE_PATH.stringValue()).build();
  final Appearance appearance = new Appearance.Builder(DBEERPEDIA.BREWERY_APPEARANCE,
      ELMO.RESOURCE_APPEARANCE, new LinkedHashModel()).build();
  final Representation representation =
      new Representation.Builder(DBEERPEDIA.BREWERIES).informationProduct(
          informationProduct).stage(stage).appearance(appearance).urlPattern(
              DBEERPEDIA.URL_PATTERN_VALUE).subRepresentation(subRepresentation).build();

  // Assert
  assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
  assertThat(representation.getInformationProduct(), equalTo(informationProduct));
  assertThat(representation.getStage(), equalTo(stage));
  assertThat(representation.getAppearance(), equalTo(appearance));
  assertThat(representation.getUrlPatterns().toArray()[0], equalTo(DBEERPEDIA.URL_PATTERN_VALUE));
  assertThat(representation.getUrlPatterns().size(), equalTo(1));
  assertThat(representation.getSubRepresentations(),
      equalTo(ImmutableList.of(subRepresentation)));
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:23,代码来源:RepresentationTest.java

示例2: testGetStatement1

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Test
public void testGetStatement1()
        throws Exception {
    Resource context1 = conn.getValueFactory().createIRI("http://marklogic.com/test/context1");
    Resource context2 = conn.getValueFactory().createIRI("http://marklogic.com/test/context2");
    File inputFile1 = new File("src/test/resources/testdata/default-graph-1.ttl");
    conn.add(inputFile1, "http://example.org/example1/", RDFFormat.TURTLE, (Resource) null);
    File inputFile2 = new File("src/test/resources/testdata/default-graph-2.ttl");
    conn.add(inputFile2, "http://example.org/example1/", RDFFormat.TURTLE, context1);
    File inputFile3 = new File("src/test/resources/testdata/default-graph-2.ttl");
    conn.add(inputFile3, "http://example.org/example1/", RDFFormat.TURTLE, context2);

    conn.clear(null, context1);
    RepositoryResult<Statement> statements = conn.getStatements(null, null, null, true);
    Model model = Iterations.addAll(statements, new LinkedHashModel());

    Assert.assertEquals(4, model.size());
    conn.clear();
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:20,代码来源:MarkLogicRepositoryConnectionTest.java

示例3: testGetStatementIsEqualToSize

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Test
public void testGetStatementIsEqualToSize() throws Exception{
    Resource context5 = conn.getValueFactory().createIRI("http://marklogic.com/test/context5");

    ValueFactory f= conn.getValueFactory();

    IRI alice = f.createIRI("http://example.org/people/alice");
    IRI bob = f.createIRI("http://example.org/people/bob");
    IRI name = f.createIRI("http://example.org/ontology/name");
    IRI person = f.createIRI("http://example.org/ontology/Person");
    Literal bobsName = f.createLiteral("Bob");
    Literal alicesName = f.createLiteral("Alice");

    conn.add(alice, RDF.TYPE, person, null, context5);
    conn.add(alice, name, alicesName, null, context5);
    conn.add(bob, RDF.TYPE, person, context5);
    conn.add(bob, name, bobsName, context5);

    RepositoryResult<Statement> statements = conn.getStatements(null, null, null, true, null,context5);
    Model aboutPeople = Iterations.addAll(statements, new LinkedHashModel());

    Assert.assertEquals(conn.size(null,context5),aboutPeople.size());
    conn.clear(null,context5);
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:25,代码来源:MarkLogicRepositoryConnectionTest.java

示例4: testConnectionWithMLConnectionVariablesWithoutDatabase

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Test
public void testConnectionWithMLConnectionVariablesWithoutDatabase()
{
    MarkLogicRepository markLogicRepository = new MarkLogicRepository(host, port, new DatabaseClientFactory.DigestAuthContext(user, password));
    markLogicRepository.initialize();
    MarkLogicRepositoryConnection con = markLogicRepository.getConnection();
    ValueFactory vf =  con.getValueFactory();
    Resource context10 = vf.createIRI("http://marklogic.com/test/context10");
    IRI alice = vf.createIRI("http://example.org/people/alice");
    IRI name = vf.createIRI("http://example.org/ontology/name");
    Literal alicesName = vf.createLiteral("Alice");
    con.begin();
    con.add(alice, name, alicesName, context10);
    con.commit();
    RepositoryResult<Statement> result = con.getStatements(alice, null, null, context10);
    Model model = Iterations.addAll(result, new LinkedHashModel());
    Assert.assertEquals(1, model.size());

    markLogicRepository.shutDown();
    markLogicRepository.initialize();
    con = markLogicRepository.getConnection();
    result = con.getStatements(alice, null, null, context10);
    model = Iterations.addAll(result, new LinkedHashModel());
    Assert.assertEquals(1, model.size());
    con.clear();
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:27,代码来源:MarkLogicRepositoryConnectionTest.java

示例5: testConnectionWithMLConnectionVariablesWithDatabase

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Test
public void testConnectionWithMLConnectionVariablesWithDatabase()
{
    MarkLogicRepository markLogicRepository = new MarkLogicRepository(host, port, user, password, "marklogic-rdf4j-test-content", "DIGEST");
    markLogicRepository.initialize();
    MarkLogicRepositoryConnection con = markLogicRepository.getConnection();
    ValueFactory vf =  con.getValueFactory();
    Resource context11 = vf.createIRI("http://marklogic.com/test/context11");
    IRI alice = vf.createIRI("http://example.org/people/alice");
    IRI name = vf.createIRI("http://example.org/ontology/name");
    Literal alicesName = vf.createLiteral("Alice");
    con.begin();
    con.add(alice, name, alicesName, context11);
    con.commit();
    RepositoryResult<Statement> result = con.getStatements(alice, null, null, context11);
    Model model = Iterations.addAll(result, new LinkedHashModel());
    Assert.assertEquals(1, model.size());

    markLogicRepository.shutDown();
    markLogicRepository.initialize();
    con = markLogicRepository.getConnection();
    result = con.getStatements(alice, null, null, context11);
    model = Iterations.addAll(result, new LinkedHashModel());
    Assert.assertEquals(1, model.size());
    con.clear();
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:27,代码来源:MarkLogicRepositoryConnectionTest.java

示例6: testConnectionWithMLClientApiSecurityContextWithoutDatabase

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Test
public void testConnectionWithMLClientApiSecurityContextWithoutDatabase()
{
    MarkLogicRepository markLogicRepository = new MarkLogicRepository(host, port, new DatabaseClientFactory.DigestAuthContext(user, password));
    markLogicRepository.initialize();
    MarkLogicRepositoryConnection con = markLogicRepository.getConnection();
    ValueFactory vf =  con.getValueFactory();
    Resource context12 = vf.createIRI("http://marklogic.com/test/context12");
    IRI alice = vf.createIRI("http://example.org/people/alice");
    IRI name = vf.createIRI("http://example.org/ontology/name");
    Literal alicesName = vf.createLiteral("Alice");
    con.begin();
    con.add(alice, name, alicesName, context12);
    con.commit();
    RepositoryResult<Statement> result = con.getStatements(alice, null, null, context12);
    Model model = Iterations.addAll(result, new LinkedHashModel());
    Assert.assertEquals(1, model.size());

    markLogicRepository.shutDown();
    markLogicRepository.initialize();
    con = markLogicRepository.getConnection();
    result = con.getStatements(alice, null, null, context12);
    model = Iterations.addAll(result, new LinkedHashModel());
    Assert.assertEquals(1, model.size());
    con.clear();
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:27,代码来源:MarkLogicRepositoryConnectionTest.java

示例7: testConnectionWithMLClientApiSecurityContextWithDatabase

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Test
public void testConnectionWithMLClientApiSecurityContextWithDatabase()
{
    MarkLogicRepository markLogicRepository = new MarkLogicRepository(host, port, "marklogic-rdf4j-test-content", new DatabaseClientFactory.DigestAuthContext(user, password));
    markLogicRepository.initialize();
    MarkLogicRepositoryConnection con = markLogicRepository.getConnection();
    ValueFactory vf =  con.getValueFactory();
    Resource context12 = vf.createIRI("http://marklogic.com/test/context12");
    IRI alice = vf.createIRI("http://example.org/people/alice");
    IRI name = vf.createIRI("http://example.org/ontology/name");
    Literal alicesName = vf.createLiteral("Alice");
    con.begin();
    con.add(alice, name, alicesName, context12);
    con.commit();
    RepositoryResult<Statement> result = con.getStatements(alice, null, null, context12);
    Model model = Iterations.addAll(result, new LinkedHashModel());
    Assert.assertEquals(1, model.size());

    markLogicRepository.shutDown();
    markLogicRepository.initialize();
    con = markLogicRepository.getConnection();
    result = con.getStatements(alice, null, null, context12);
    model = Iterations.addAll(result, new LinkedHashModel());
    Assert.assertEquals(1, model.size());
    con.clear();
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:27,代码来源:MarkLogicRepositoryConnectionTest.java

示例8: triples2Rdf

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Override
public OutputStream triples2Rdf(List<RMapTriple> triples, RDFType rdfFormat) throws RMapException, RMapDefectiveArgumentException	{
	if (triples == null){
		throw new RMapException("Null triple list");			
	}
	if (rdfFormat==null){
		throw new RMapException("null rdf format name");
	}
	Model model = new LinkedHashModel();		
	
	for (RMapTriple triple:triples){
		model.add(ORAdapter.rMapResource2Rdf4jResource(triple.getSubject()), 
					ORAdapter.rMapIri2Rdf4jIri(triple.getPredicate()), 
					ORAdapter.rMapValue2Rdf4jValue(triple.getObject()));
	}
	OutputStream rdf = this.convertStmtListToRDF(model, rdfFormat);
	return rdf;
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:19,代码来源:RioRDFHandler.java

示例9: getAsModel

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Override
public Model getAsModel() throws RMapException {
	Model discoModel = new LinkedHashModel();
	discoModel.add(getTypeStatement());

	if (creator!=null){
		discoModel.add(getCreatorStmt());
	}
	if (description != null){
		discoModel.add(getDescriptonStatement());
	}
	if (providerIdStmt != null){
		discoModel.add(getProviderIdStmt());
	}
	if (provGeneratedByStmt != null){
		discoModel.add(getProvGeneratedByStmt());
	}

	List<Statement> aggResStmts = getAggregatedResourceStatements();
	discoModel.addAll(aggResStmts);

	if (relatedStatements != null){
		discoModel.addAll(getRelatedStatementsAsList());
	}
	return discoModel;
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:27,代码来源:ORMapDiSCO.java

示例10: isConnectedGraph

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
/**
 * Check that a list of statements form a graph that connect to at least one of 
 *
 * @param connectingNodes - list of nodes that all statements must connect to
 * @param relatedStatements ORMapStatements describing aggregated resources
 * @return true if related statements are non-disjoint; else false
 * @throws RMapException the RMap exception
 */
public static boolean isConnectedGraph(List<URI> connectingNodes, List<Statement> statements)
        throws RMapException {
    if (statements == null || statements.size() == 0) {
        //there are no statements, so for the purpose of this RMap there are no disconnected statements...
        //i.e. graph is connected
        return true;
    }
 
    Set<Resource> startingPoints = new HashSet<Resource>();
    for (URI node : connectingNodes) {
    	startingPoints.add(ORAdapter.uri2Rdf4jIri(node));
    }
    
    Model stmts = new LinkedHashModel(statements);
    for (Resource res : startingPoints) {
    	stmts = removeConnected(stmts, res);
    	if (stmts.size()==0) {
    		return true;
    	}
    }
    
    return false;
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:32,代码来源:OStatementsAdapter.java

示例11: getAsModel

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Override
public Model getAsModel() throws RMapException {
	Model eventModel = new LinkedHashModel();
	eventModel.add(typeStatement);
	eventModel.add(associatedAgentStmt);
	eventModel.add(eventTypeStmt);
	eventModel.add(eventTargetTypeStmt);
	eventModel.add(startTimeStmt);
	if (endTimeStmt != null){
		eventModel.add(endTimeStmt);
	}
	if (descriptionStmt != null){
		eventModel.add(descriptionStmt);
	}
	if (associatedKeyStmt != null){
		eventModel.add(associatedKeyStmt);
	}
	return eventModel;
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:20,代码来源:ORMapEvent.java

示例12: testGetDiscoContext

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
/**
 * Test method for {@link info.rmapproject.core.model.impl.rdf4j.ORMapDiSCO#getDiscoContext()}.
 * @throws RMapDefectiveArgumentException 
 * @throws RMapException 
 */
@Test
public void testGetDiscoContext() throws RMapException, RMapDefectiveArgumentException {
	List<java.net.URI> resourceList = new ArrayList<java.net.URI>();
	try {
		resourceList.add(new java.net.URI("http://rmap-info.org"));
		resourceList.add(new java.net.URI
				("https://rmap-project.atlassian.net/wiki/display/RMAPPS/RMap+Wiki"));
		RMapIri author = ORAdapter.rdf4jIri2RMapIri(creatorIRI);
		ORMapDiSCO disco = new ORMapDiSCO(uri2Rdf4jIri(create("http://example.org/disco/" + counter.getAndIncrement())), author, resourceList);
		IRI context = disco.getDiscoContext();
		Model model = new LinkedHashModel();
		for (Statement stm:model){
			assertEquals(context, stm.getContext());
		}
	} catch (URISyntaxException e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:25,代码来源:ORMapDiscoTest.java

示例13: parseConfig

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
private Model parseConfig(File file) throws SailConfigException, IOException
{
    RDFFormat format = Rio.getParserFormatForFileName(file.getAbsolutePath()).get();
    if (format==null)
        throw new SailConfigException("Unsupported file format: " + file.getAbsolutePath());
    RDFParser parser = Rio.createParser(format);
    Model model = new LinkedHashModel();
    parser.setRDFHandler(new StatementCollector(model));
    InputStream stream = new FileInputStream(file);

    try {
        parser.parse(stream, file.getAbsolutePath());
    } catch (Exception e) {
        throw new SailConfigException("Error parsing file!");
    }

    stream.close();
    return model;
}
 
开发者ID:semagrow,项目名称:semagrow,代码行数:20,代码来源:SemagrowRepositoryResolver.java

示例14: testAddStatementsForEntityType

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Test
public void testAddStatementsForEntityType()
{
	Model model = new LinkedHashModel();
	Resource subject = valueFactory.createIRI("http://example.org/subject");
	LabeledResource object = new LabeledResource( "http://example.org/object", "object");
	LabeledResource codeSystem = new LabeledResource( "ex:object");

	SemanticTag<EntityType, LabeledResource, LabeledResource> tag =
			new SemanticTag<>("tagId", entityType, Relation.isAssociatedWith, object, codeSystem);

	when(tagService.getTagsForEntity(entityType)).thenReturn(singletonList(tag));


	writer.addStatementsForEntityTags(model, subject, entityType);

	Statement statement = valueFactory.createStatement(subject, TYPE, valueFactory.createIRI("http://example.org/object"));
	assertEquals(newArrayList(model), singletonList(statement));
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:20,代码来源:EntityModelWriterTest.java

示例15: setUp

import org.eclipse.rdf4j.model.impl.LinkedHashModel; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    testDir = tempDir.newFolder("schema-generator-test").toPath();

    ValueFactory vf = SimpleValueFactory.getInstance();

    String ns = "http://example.com/ns/ontology#";
    testOntologyUri = vf.createIRI(ns);
    testProperty1 = vf.createIRI(ns, "property1");
    testProperty2 = vf.createIRI(ns, "property_2");
    testProperty3 = vf.createIRI(ns, "property-3");
    testProperty4 = vf.createIRI(ns, "propertyLocalised4");
    testProperty1Description = vf.createLiteral("property 1 description");
    testProperty2Description = vf.createLiteral("property 2 description");
    testProperty3Description = vf.createLiteral("property 3 description");
    testProperty4DescriptionEn = vf.createLiteral("property 4 description english", "en");
    testProperty4DescriptionFr = vf.createLiteral("Description de la propriété français", "fr");

    Model testOntology = new LinkedHashModel();
    testOntology.add(testOntologyUri, RDF.TYPE, OWL.ONTOLOGY);
    testOntology.add(testProperty1, RDF.TYPE, OWL.DATATYPEPROPERTY);
    testOntology.add(testProperty2, RDF.TYPE, OWL.OBJECTPROPERTY);
    testOntology.add(testProperty3, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
    testOntology.add(testProperty4, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
    testOntology.add(testProperty1, DCTERMS.DESCRIPTION, testProperty1Description);
    testOntology.add(testProperty2, RDFS.COMMENT, testProperty2Description);
    testOntology.add(testProperty3, SKOS.DEFINITION, testProperty3Description);
    testOntology.add(testProperty4, SKOS.PREF_LABEL, testProperty4DescriptionEn);
    testOntology.add(testProperty4, SKOS.PREF_LABEL, testProperty4DescriptionFr);
    String fileName = "test." + format.getDefaultFileExtension();
    inputPath = testDir.resolve(fileName);
    try (final OutputStream outputStream = Files.newOutputStream(inputPath)) {
        Rio.write(testOntology, outputStream, format);
    }
}
 
开发者ID:ansell,项目名称:rdf4j-schema-generator,代码行数:36,代码来源:SchemaGeneratorTest.java


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