Search in sources :

Example 1 with SesameYard

use of org.apache.stanbol.entityhub.yard.sesame.SesameYard in project stanbol by apache.

the class SesameContextTest method initYard.

@BeforeClass
public static final void initYard() throws RepositoryException {
    repo.initialize();
    //create the graphs in Clerezza
    //init the ClerezzaYards for the created Clerezza graphs
    SesameYardConfig yard1config = new SesameYardConfig("context 1 yard");
    yard1config.setName("Yard over context 1");
    yard1config.setContextEnabled(true);
    yard1config.setContexts(new String[] { CONTEXT1.stringValue() });
    yard1 = new SesameYard(repo, yard1config);
    SesameYardConfig yard2config = new SesameYardConfig("context 2 yard");
    yard2config.setName("Yard over context 2");
    yard2config.setContextEnabled(true);
    yard2config.setContexts(new String[] { CONTEXT2.stringValue() });
    yard2 = new SesameYard(repo, yard2config);
    SesameYardConfig unionYardConfig = new SesameYardConfig("union yard");
    unionYardConfig.setName("Union Yard");
    unionYard = new SesameYard(repo, unionYardConfig);
    yards = Arrays.asList(yard1, yard2, unionYard);
    //add the test data (to the Repository to also test pre-existing data)
    RepositoryConnection con = repo.getConnection();
    con.begin();
    URI entity1 = sesameFactory.createURI("http://www.test.org/entity1");
    con.add(entity1, rdfType, skosConcept, CONTEXT1);
    con.add(entity1, skosPrefLabel, sesameFactory.createLiteral("test context one", EN), CONTEXT1);
    con.add(entity1, skosPrefLabel, sesameFactory.createLiteral("Test Context Eins", DE), CONTEXT1);
    expectedEntities.put(entity1, Arrays.asList(yard1, unionYard));
    URI entity2 = sesameFactory.createURI("http://www.test.org/entity2");
    con.add(entity2, rdfType, skosConcept, CONTEXT2);
    con.add(entity2, skosPrefLabel, sesameFactory.createLiteral("test context two", EN), CONTEXT2);
    con.add(entity2, skosPrefLabel, sesameFactory.createLiteral("Test Context Zwei", DE), CONTEXT2);
    expectedEntities.put(entity2, Arrays.asList(yard2, unionYard));
    con.commit();
    con.close();
}
Also used : RepositoryConnection(org.openrdf.repository.RepositoryConnection) SesameYardConfig(org.apache.stanbol.entityhub.yard.sesame.SesameYardConfig) URI(org.openrdf.model.URI) SesameYard(org.apache.stanbol.entityhub.yard.sesame.SesameYard) BeforeClass(org.junit.BeforeClass)

Example 2 with SesameYard

use of org.apache.stanbol.entityhub.yard.sesame.SesameYard in project stanbol by apache.

the class SesameYardTest method initYard.

@BeforeClass
public static final void initYard() throws RepositoryException {
    SesameYardConfig config = new SesameYardConfig("testYardId");
    config.setName("Sesame Yard Test");
    config.setDescription("The Sesame Yard instance used to execute the Unit Tests defined for the Yard Interface");
    repo = new SailRepository(new MemoryStore());
    repo.initialize();
    yard = new SesameYard(repo, config);
}
Also used : MemoryStore(org.openrdf.sail.memory.MemoryStore) SesameYardConfig(org.apache.stanbol.entityhub.yard.sesame.SesameYardConfig) SailRepository(org.openrdf.repository.sail.SailRepository) SesameYard(org.apache.stanbol.entityhub.yard.sesame.SesameYard) BeforeClass(org.junit.BeforeClass)

Example 3 with SesameYard

use of org.apache.stanbol.entityhub.yard.sesame.SesameYard in project stanbol by apache.

the class SesameYardComponent method registerSesameYard.

/**
	 * @param serviceReference
	 * @param repo
	 */
protected void registerSesameYard(ServiceReference serviceReference, Repository repo) {
    yard = new SesameYard(repo, yardConfig);
    yardService = bundleContext.registerService(Yard.class.getName(), yard, config);
    repoServiceReference = serviceReference;
}
Also used : SesameYard(org.apache.stanbol.entityhub.yard.sesame.SesameYard)

Aggregations

SesameYard (org.apache.stanbol.entityhub.yard.sesame.SesameYard)3 SesameYardConfig (org.apache.stanbol.entityhub.yard.sesame.SesameYardConfig)2 BeforeClass (org.junit.BeforeClass)2 URI (org.openrdf.model.URI)1 RepositoryConnection (org.openrdf.repository.RepositoryConnection)1 SailRepository (org.openrdf.repository.sail.SailRepository)1 MemoryStore (org.openrdf.sail.memory.MemoryStore)1