org.eclipse.rdf4j.model.impl.TreeModel Java Examples

The following examples show how to use org.eclipse.rdf4j.model.impl.TreeModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalRepositoryManagerIntegrationTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
@Deprecated
public void testAddToSystemRepository() {
	RepositoryConfig config = subject.getRepositoryConfig(TEST_REPO);
	subject.addRepositoryConfig(new RepositoryConfig(SystemRepository.ID, new SystemRepositoryConfig()));
	subject.shutDown();
	subject = new LocalRepositoryManager(datadir);
	subject.initialize();
	try (RepositoryConnection con = subject.getSystemRepository().getConnection()) {
		Model model = new TreeModel();
		config.setID("changed");
		config.export(model, con.getValueFactory().createBNode());
		con.begin();
		con.add(model, con.getValueFactory().createBNode());
		con.commit();
	}
	assertTrue(subject.hasRepositoryConfig("changed"));
}
 
Example #2
Source File: VOIDInferencerConnection.java    From semagrow with Apache License 2.0 6 votes vote down vote up
@Override
public void flushUpdates()
        throws SailException
{
    super.flushUpdates();

    if (statementsRemoved) {
        //logger.debug("statements removed, starting inferencing from scratch");
        clearInferred();
        addAxiomStatements();

        newStatements = new TreeModel();
        Iterations.addAll(getWrappedConnection().getStatements(null, null, null, true), newStatements);

        statementsRemoved = false;
    }

    doInferencing();
}
 
Example #3
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 6 votes vote down vote up
@Test
public void testExportAndParse2() throws Exception {
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.setTablespace(null);
    cfg.setSplitBits(5);
    cfg.setCreate(true);
    cfg.setPush(true);
    TreeModel g = new TreeModel();
    cfg.export(g);
    cfg = new HBaseSailConfig();
    cfg.parse(g, null);
    assertNull(cfg.getTablespace());
    assertEquals(5, cfg.getSplitBits());
    assertTrue(cfg.isCreate());
    assertTrue(cfg.isPush());
    assertEquals("", cfg.getElasticIndexURL());
}
 
Example #4
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 6 votes vote down vote up
@Test
public void testExportAndParse() throws Exception {
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.setTablespace("whatevertable");
    cfg.setSplitBits(7);
    cfg.setCreate(false);
    cfg.setPush(false);
    cfg.setElasticIndexURL("http://whateverURL/index");
    TreeModel g = new TreeModel();
    cfg.export(g);
    cfg = new HBaseSailConfig();
    cfg.parse(g, null);
    assertEquals("whatevertable", cfg.getTablespace());
    assertEquals(7, cfg.getSplitBits());
    assertFalse(cfg.isCreate());
    assertFalse(cfg.isPush());
    assertEquals("http://whateverURL/index", cfg.getElasticIndexURL());
}
 
Example #5
Source File: RDFCollectionsTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void testRemove() {
	Resource head = vf.createBNode();
	Model m = RDFCollections.asRDF(values, head, new TreeModel());

	// add something to the model that is not part of the RDF collection.
	m.add(RDF.TYPE, RDF.TYPE, RDF.PROPERTY);

	// remove the entire collection
	RDFCollections.extract(m, head, st -> m.remove(st));

	assertFalse(m.contains(null, RDF.FIRST, a));
	assertFalse(m.contains(null, RDF.FIRST, b));
	assertFalse(m.contains(null, RDF.FIRST, c));
	assertFalse(m.contains(head, null, null));
	assertTrue(m.contains(RDF.TYPE, RDF.TYPE, RDF.PROPERTY));
}
 
Example #6
Source File: ModelsTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void testConvertRDFStarToReification() {
	Model rdfStarModel = RDFStarTestHelper.createRDFStarModel();
	Model referenceModel = RDFStarTestHelper.createRDFReificationModel();

	Model reificationModel1 = Models.convertRDFStarToReification(VF, rdfStarModel);
	assertTrue("RDF* conversion to reification with explicit VF, model-to-model",
			Models.isomorphic(reificationModel1, referenceModel));

	Model reificationModel2 = Models.convertRDFStarToReification(rdfStarModel);
	assertTrue("RDF* conversion to reification with implicit VF, model-to-model",
			Models.isomorphic(reificationModel2, referenceModel));

	Model reificationModel3 = new TreeModel();
	Models.convertRDFStarToReification(VF, rdfStarModel, (Consumer<Statement>) reificationModel3::add);
	assertTrue("RDF* conversion to reification with explicit VF, model-to-consumer",
			Models.isomorphic(reificationModel3, referenceModel));

	Model reificationModel4 = new TreeModel();
	Models.convertRDFStarToReification(rdfStarModel, reificationModel4::add);
	assertTrue("RDF* conversion to reification with explicit VF, model-to-consumer",
			Models.isomorphic(reificationModel4, referenceModel));
}
 
Example #7
Source File: ModelsTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void testConvertIncompleteReificationToRDFStar() {
	// Incomplete RDF reification (missing type, subject, predicate or object) should not add statements
	// and should not remove any of the existing incomplete reification statements.
	Model incompleteReificationModel = RDFStarTestHelper.createIncompleteRDFReificationModel();

	Model rdfStarModel1 = Models.convertReificationToRDFStar(VF, incompleteReificationModel);
	assertTrue("Incomplete RDF reification conversion to RDF* with explicit VF, model-to-model",
			Models.isomorphic(rdfStarModel1, incompleteReificationModel));

	Model rdfStarModel2 = Models.convertReificationToRDFStar(incompleteReificationModel);
	assertTrue("Incomplete RDF reification conversion to RDF* with implicit VF, model-to-model",
			Models.isomorphic(rdfStarModel2, incompleteReificationModel));

	Model rdfStarModel3 = new TreeModel();
	Models.convertReificationToRDFStar(VF, incompleteReificationModel, (Consumer<Statement>) rdfStarModel3::add);
	assertTrue("Incomplete RDF reification conversion to RDF* with explicit VF, model-to-consumer",
			Models.isomorphic(rdfStarModel3, incompleteReificationModel));

	Model rdfStarModel4 = new TreeModel();
	Models.convertReificationToRDFStar(incompleteReificationModel, rdfStarModel4::add);
	assertTrue("Incomplete RDF reification conversion to RDF* with implicit VF, model-to-consumer",
			Models.isomorphic(rdfStarModel4, incompleteReificationModel));
}
 
Example #8
Source File: ModelsTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void testConvertReificationToRDFStar() {
	Model reificationModel = RDFStarTestHelper.createRDFReificationModel();
	Model referenceRDFStarModel = RDFStarTestHelper.createRDFStarModel();

	Model rdfStarModel1 = Models.convertReificationToRDFStar(VF, reificationModel);
	assertTrue("RDF reification conversion to RDF* with explicit VF, model-to-model",
			Models.isomorphic(rdfStarModel1, referenceRDFStarModel));

	Model rdfStarModel2 = Models.convertReificationToRDFStar(reificationModel);
	assertTrue("RDF reification conversion to RDF* with implicit VF, model-to-model",
			Models.isomorphic(rdfStarModel2, referenceRDFStarModel));

	Model rdfStarModel3 = new TreeModel();
	Models.convertReificationToRDFStar(VF, reificationModel, (Consumer<Statement>) rdfStarModel3::add);
	assertTrue("RDF reification conversion to RDF* with explicit VF, model-to-consumer",
			Models.isomorphic(rdfStarModel3, referenceRDFStarModel));

	Model rdfStarModel4 = new TreeModel();
	Models.convertReificationToRDFStar(reificationModel, rdfStarModel4::add);
	assertTrue("RDF reification conversion to RDF* with implicit VF, model-to-consumer",
			Models.isomorphic(rdfStarModel4, referenceRDFStarModel));
}
 
Example #9
Source File: DAWGTestResultSetUtil.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static Model toGraph(TupleQueryResult tqr) throws QueryEvaluationException {
	Model graph = new TreeModel();
	DAWGTestResultSetWriter writer = new DAWGTestResultSetWriter(new StatementCollector(graph));

	try {
		writer.startQueryResult(tqr.getBindingNames());
		while (tqr.hasNext()) {
			writer.handleSolution(tqr.next());
		}
		writer.endQueryResult();
	} catch (TupleQueryResultHandlerException e) {
		// No exceptions expected from DAWGTestResultSetWriter or
		// StatementCollector, foud a bug?
		throw new RuntimeException(e);
	}

	return graph;
}
 
Example #10
Source File: ShaclSailConfigTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void exportAddsAllConfigData() {
	Model m = new TreeModel();
	Resource node = subject.export(m);
	assertThat(m.contains(node, PARALLEL_VALIDATION, null)).isTrue();
	assertThat(m.contains(node, UNDEFINED_TARGET_VALIDATES_ALL_SUBJECTS, null)).isTrue();
	assertThat(m.contains(node, LOG_VALIDATION_PLANS, null)).isTrue();
	assertThat(m.contains(node, LOG_VALIDATION_VIOLATIONS, null)).isTrue();
	assertThat(m.contains(node, IGNORE_NO_SHAPES_LOADED_EXCEPTION, null)).isTrue();
	assertThat(m.contains(node, VALIDATION_ENABLED, null)).isTrue();
	assertThat(m.contains(node, CACHE_SELECT_NODES, null)).isTrue();
	assertThat(m.contains(node, GLOBAL_LOG_VALIDATION_EXECUTION, null)).isTrue();
	assertThat(m.contains(node, RDFS_SUB_CLASS_REASONING, null)).isTrue();
	assertThat(m.contains(node, PERFORMANCE_LOGGING, null)).isTrue();
	assertThat(m.contains(node, SERIALIZABLE_VALIDATION, null)).isTrue();

}
 
Example #11
Source File: ElasticsearchStoreConfigTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void exportAddsAllConfigData() {

	mb
			.add(ElasticsearchStoreSchema.hostname, "host1")
			.add(ElasticsearchStoreSchema.clusterName, "cluster1")
			.add(ElasticsearchStoreSchema.index, "index1")
			.add(ElasticsearchStoreSchema.port, 9300);
	// @formatter:on

	subject.parse(mb.build(), implNode);

	Model m = new TreeModel();
	Resource node = subject.export(m);

	assertThat(m.contains(node, ElasticsearchStoreSchema.hostname, null)).isTrue();
	assertThat(m.contains(node, ElasticsearchStoreSchema.clusterName, null)).isTrue();
	assertThat(m.contains(node, ElasticsearchStoreSchema.index, null)).isTrue();
	assertThat(m.contains(node, ElasticsearchStoreSchema.port, null)).isTrue();

}
 
Example #12
Source File: EndpointFactory.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Utility function to load federation members from a data configuration file.
 *
 * <p>
 * A data configuration file provides information about federation members in form of turtle. Currently the types
 * NativeStore, ResolvableEndpoint and SPARQLEndpoint are supported. For details please refer to the documentation
 * in {@link NativeRepositoryInformation}, {@link ResolvableRepositoryInformation} and
 * {@link SPARQLRepositoryInformation}.
 * </p>
 *
 * @param dataConfig
 *
 * @return a list of initialized endpoints, i.e. the federation members
 *
 * @throws IOException
 * @throws Exception
 */
public static List<Endpoint> loadFederationMembers(File dataConfig, File fedXBaseDir) throws FedXException {

	if (!dataConfig.exists()) {
		throw new FedXRuntimeException("File does not exist: " + dataConfig.getAbsolutePath());
	}

	Model graph = new TreeModel();
	RDFParser parser = Rio.createParser(RDFFormat.TURTLE);
	RDFHandler handler = new DefaultRDFHandler(graph);
	parser.setRDFHandler(handler);
	try (FileReader fr = new FileReader(dataConfig)) {
		parser.parse(fr, Vocabulary.FEDX.NAMESPACE);
	} catch (Exception e) {
		throw new FedXException("Unable to parse dataconfig " + dataConfig + ":" + e.getMessage());
	}

	return loadFederationMembers(graph, fedXBaseDir);
}
 
Example #13
Source File: FedXRepositoryConfig.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void parse(Model m, Resource implNode) throws RepositoryConfigException {
	super.parse(m, implNode);

	try {
		Models.objectLiteral(m.getStatements(implNode, DATA_CONFIG, null))
				.ifPresent(value -> setDataConfig(value.stringValue()));

		Set<Value> memberNodes = m.filter(implNode, MEMBER, null).objects();
		if (!memberNodes.isEmpty()) {
			Model members = new TreeModel();

			// add all statements for the given member node
			for (Value memberNode : memberNodes) {
				if (!(memberNode instanceof Resource)) {
					throw new RepositoryConfigException("Member nodes must be of type resource, was " + memberNode);
				}
				members.addAll(m.filter((Resource) memberNode, null, null));
			}

			this.members = members;
		}
	} catch (ModelException e) {
		throw new RepositoryConfigException(e.getMessage(), e);
	}
}
 
Example #14
Source File: LocalRepositoryManagerIntegrationTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
@Deprecated
public void testModifySystemRepository() {
	RepositoryConfig config = subject.getRepositoryConfig(TEST_REPO);
	subject.addRepositoryConfig(new RepositoryConfig(SystemRepository.ID, new SystemRepositoryConfig()));
	subject.shutDown();
	subject = new LocalRepositoryManager(datadir);
	subject.initialize();
	try (RepositoryConnection con = subject.getSystemRepository().getConnection()) {
		Model model = new TreeModel();
		config.setTitle("Changed");
		config.export(model, con.getValueFactory().createBNode());
		Resource ctx = RepositoryConfigUtil.getContext(con, config.getID());
		con.begin();
		con.clear(ctx);
		con.add(model, ctx == null ? con.getValueFactory().createBNode() : ctx);
		con.commit();
	}
	assertEquals("Changed", subject.getRepositoryConfig(TEST_REPO).getTitle());
}
 
Example #15
Source File: LocalRepositoryManagerIntegrationTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
@Deprecated
public void testRemoveFromSystemRepository() {
	RepositoryConfig config = subject.getRepositoryConfig(TEST_REPO);
	subject.addRepositoryConfig(new RepositoryConfig(SystemRepository.ID, new SystemRepositoryConfig()));
	subject.shutDown();
	subject = new LocalRepositoryManager(datadir);
	subject.initialize();
	try (RepositoryConnection con = subject.getSystemRepository().getConnection()) {
		Model model = new TreeModel();
		config.setID("changed");
		config.export(model, con.getValueFactory().createBNode());
		con.begin();
		con.add(model, con.getValueFactory().createBNode());
		con.commit();
	}
	assertTrue(subject.hasRepositoryConfig("changed"));
	try (RepositoryConnection con = subject.getSystemRepository().getConnection()) {
		con.begin();
		con.clear(RepositoryConfigUtil.getContext(con, config.getID()));
		con.commit();
	}
	assertFalse(subject.hasRepositoryConfig(config.getID()));
}
 
Example #16
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaultTableSpaceFromMissingRepoImpl() throws Exception {
    TreeModel g = new TreeModel();
    IRI node = SimpleValueFactory.getInstance().createIRI("http://node");
    g.add(node, SailRepositorySchema.SAILIMPL, node);
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
    assertNull(cfg.getTablespace());
}
 
Example #17
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaultTableSpaceFromMissingRepositoryId() throws Exception {
    TreeModel g = new TreeModel();
    IRI node = SimpleValueFactory.getInstance().createIRI("http://node");
    g.add(node, SailRepositorySchema.SAILIMPL, node);
    g.add(node, RepositoryConfigSchema.REPOSITORYIMPL, node);
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
    assertNull(cfg.getTablespace());
}
 
Example #18
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaultTableSpaceFromRepositoryId() throws Exception {
    TreeModel g = new TreeModel();
    IRI node = SimpleValueFactory.getInstance().createIRI("http://node");
    Literal id =  SimpleValueFactory.getInstance().createLiteral("testId");
    g.add(node, SailRepositorySchema.SAILIMPL, node);
    g.add(node, SailConfigSchema.DELEGATE, node);
    g.add(node, RepositoryConfigSchema.REPOSITORYIMPL, node);
    g.add(node, RepositoryConfigSchema.REPOSITORYID, id);
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
    assertEquals(id.stringValue(), cfg.getTablespace());
}
 
Example #19
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test
public void testEmptyTableSpace() throws Exception {
    TreeModel g = new TreeModel();
    IRI node = SimpleValueFactory.getInstance().createIRI("http://node");
    g.add(node, HALYARD.TABLE_NAME_PROPERTY, SimpleValueFactory.getInstance().createLiteral(""));
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
    assertNull(cfg.getTablespace());
}
 
Example #20
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseEmpty() throws Exception {
    TreeModel g = new TreeModel();
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
    assertNull(cfg.getTablespace());
    assertEquals(0, cfg.getSplitBits());
    assertTrue(cfg.isCreate());
    assertTrue(cfg.isPush());
    assertEquals("", cfg.getElasticIndexURL());
}
 
Example #21
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test(expected = SailConfigException.class)
public void testSplitbitsFail() throws Exception {
    TreeModel g = new TreeModel();
    g.add(SimpleValueFactory.getInstance().createIRI("http://node"), HALYARD.SPLITBITS_PROPERTY, SimpleValueFactory.getInstance().createLiteral("not a number"));
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
}
 
Example #22
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test(expected = SailConfigException.class)
public void testCreateTableFail() throws Exception {
    TreeModel g = new TreeModel();
    g.add(SimpleValueFactory.getInstance().createIRI("http://node"), HALYARD.CREATE_TABLE_PROPERTY, SimpleValueFactory.getInstance().createLiteral("not a boolean"));
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
}
 
Example #23
Source File: StatementsTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testMultipleContexts() {
	Resource c1 = vf.createIRI("urn:c1");
	Resource c2 = vf.createIRI("urn:c1");
	Resource c3 = vf.createIRI("urn:c1");

	Model m = Statements.create(vf, FOAF.AGE, RDF.TYPE, RDF.PROPERTY, new TreeModel(), c1, c2, null, c3);
	assertFalse(m.isEmpty());
	assertTrue(m.contains(FOAF.AGE, RDF.TYPE, RDF.PROPERTY, (Resource) null));
	assertTrue(m.contains(FOAF.AGE, RDF.TYPE, RDF.PROPERTY, c1));
	assertTrue(m.contains(FOAF.AGE, RDF.TYPE, RDF.PROPERTY, c2));
	assertTrue(m.contains(FOAF.AGE, RDF.TYPE, RDF.PROPERTY, c3));
}
 
Example #24
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test(expected = SailConfigException.class)
public void testPushStrategyFail() throws Exception {
    TreeModel g = new TreeModel();
    g.add(SimpleValueFactory.getInstance().createIRI("http://node"), HALYARD.PUSH_STRATEGY_PROPERTY, SimpleValueFactory.getInstance().createLiteral("not a boolean"));
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
}
 
Example #25
Source File: RDFCollectionsTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testExtract() {
	Resource head = vf.createBNode();
	Model m = RDFCollections.asRDF(values, head, new TreeModel());

	// add something to the model that is not part of the RDF collection.
	m.add(RDF.TYPE, RDF.TYPE, RDF.PROPERTY);

	Model collection = RDFCollections.getCollection(m, head, new TreeModel());
	assertNotNull(collection);
	assertFalse(collection.contains(RDF.TYPE, RDF.TYPE, RDF.PROPERTY));
	assertTrue(collection.contains(null, RDF.FIRST, a));
	assertTrue(collection.contains(null, RDF.FIRST, b));
	assertTrue(collection.contains(null, RDF.FIRST, c));
}
 
Example #26
Source File: RDFCollectionsTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testInjectedValueFactoryIsUsed() {
	Resource head = vf.createBNode();
	ValueFactory injected = mock(SimpleValueFactory.class, CALLS_REAL_METHODS);
	RDFCollections.asRDF(values, head, new TreeModel(), injected);
	verify(injected, atLeastOnce()).createStatement(any(), any(), any());
}
 
Example #27
Source File: RDFCollectionsTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testConversionRoundtrip() {
	IRI head = vf.createIRI("urn:head");
	Model m = RDFCollections.asRDF(values, head, new TreeModel());
	assertNotNull(m);
	assertTrue(m.contains(head, RDF.FIRST, a));
	assertFalse(m.contains(null, RDF.REST, head));

	List<Value> newList = RDFCollections.asValues(m, head, new ArrayList<>());
	assertNotNull(newList);
	assertTrue(newList.contains(a));
	assertTrue(newList.contains(b));
	assertTrue(newList.contains(c));

}
 
Example #28
Source File: IsomorphicTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeClass
public static void beforeClass() {
	empty = getModel("empty.ttl");
	blankNodes = getModel("blankNodes.ttl");
	shacl = getModel("shacl.ttl");
	longChain = getModel("longChain.ttl");
	sparqlTestCase = getModel("sparqlTestCase.ttl");
	spinFullForwardchained = getModel("spin-full-forwardchained.ttl");
	bsbm = getModel("bsbm-100.ttl");
	bsbmChanged = getModel("bsbm-100-changed.ttl");
	bsbm_arraylist = new ArrayList<>(bsbm);
	bsbmTree = new TreeModel(bsbm);
	list = getModel("list.ttl");
	internallyIsomorphic = getModel("internallyIsomorphic.ttl");
	manyProperties = getModel("manyProperties.ttl");
	manyProperties2 = getModel("manyProperties2.ttl");

	empty_2 = getModel("empty.ttl");
	blankNodes_2 = getModel("blankNodes.ttl");
	shacl_2 = getModel("shacl.ttl");
	longChain_2 = getModel("longChain.ttl");
	sparqlTestCase_2 = getModel("sparqlTestCase.ttl");
	spinFullForwardchained_2 = getModel("spin-full-forwardchained.ttl");
	bsbm_2 = getModel("bsbm-100.ttl");
	bsbm_arraylist_2 = new ArrayList<>(bsbm);
	bsbmTree_2 = new TreeModel(bsbm);
	list_2 = getModel("list.ttl");
	internallyIsomorphic_2 = getModel("internallyIsomorphic.ttl");
	manyProperties_2 = getModel("manyProperties.ttl");
	manyProperties2_2 = getModel("manyProperties2.ttl");

}
 
Example #29
Source File: HBaseSailConfigTest.java    From Halyard with Apache License 2.0 5 votes vote down vote up
@Test(expected = SailConfigException.class)
public void testTimeoutFail() throws Exception {
    TreeModel g = new TreeModel();
    g.add(SimpleValueFactory.getInstance().createIRI("http://node"), HALYARD.EVALUATION_TIMEOUT_PROPERTY, SimpleValueFactory.getInstance().createLiteral("not a number"));
    HBaseSailConfig cfg = new HBaseSailConfig();
    cfg.parse(g, null);
}
 
Example #30
Source File: SpinParserTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testSpinParser() throws IOException, RDF4JException {
	StatementCollector expected = new StatementCollector();
	RDFParser parser = Rio.createParser(RDFFormat.TURTLE);
	parser.setRDFHandler(expected);
	try (InputStream rdfStream = testURL.openStream()) {
		parser.parse(rdfStream, testURL.toString());
	}

	// get query resource from sp:text
	Resource queryResource = null;
	for (Statement stmt : expected.getStatements()) {
		if (SP.TEXT_PROPERTY.equals(stmt.getPredicate())) {
			queryResource = stmt.getSubject();
			break;
		}
	}
	assertNotNull(queryResource);

	TripleSource store = new ModelTripleSource(new TreeModel(expected.getStatements()));
	ParsedOperation textParsedOp = textParser.parse(queryResource, store);
	ParsedOperation rdfParsedOp = rdfParser.parse(queryResource, store);

	if (textParsedOp instanceof ParsedQuery) {
		assertEquals(((ParsedQuery) textParsedOp).getTupleExpr(), ((ParsedQuery) rdfParsedOp).getTupleExpr());
	} else {
		assertEquals(((ParsedUpdate) textParsedOp).getUpdateExprs(), ((ParsedUpdate) rdfParsedOp).getUpdateExprs());
	}
}