本文整理汇总了Java中org.openrdf.repository.config.RepositoryConfigException类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryConfigException类的具体用法?Java RepositoryConfigException怎么用?Java RepositoryConfigException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryConfigException类属于org.openrdf.repository.config包,在下文中一共展示了RepositoryConfigException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRepository
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Override
/**
* instantiate and return repository
*
*/
public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException {
MarkLogicRepository repo = null;
MarkLogicRepositoryConfig cfg = (MarkLogicRepositoryConfig) config;
if (cfg.getHost() != null && cfg.getPort() != 0) {
// init with MarkLogicRepositoryConfig
repo = new MarkLogicRepository(cfg.getHost(),cfg.getPort(),cfg.getUser(),cfg.getPassword(),cfg.getAuth());
} else if (cfg.getHost() == null) {
// init with queryEndpoint as connection string
try {
repo = new MarkLogicRepository(new URL(cfg.getQueryEndpointUrl()));
} catch (MalformedURLException e) {
logger.debug(e.getMessage());
throw new RepositoryConfigException(e.getMessage());
}
}else{
throw new RepositoryConfigException("Invalid configuration class: " + config.getClass());
}
return repo;
}
示例2: parse
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Override
/**
* parse graph representation of config
*
* @Note - Graph is deprecating soon (in Sesame) to be replaced by Model
*/
public void parse(Graph graph, Resource implNode)
throws RepositoryConfigException {
super.parse(graph, implNode);
try {
URI uri = GraphUtil.getOptionalObjectURI(graph, implNode, QUERY_ENDPOINT);
if (uri != null) {
setQueryEndpointUrl(uri.stringValue());
}
uri = GraphUtil.getOptionalObjectURI(graph, implNode, UPDATE_ENDPOINT);
if (uri != null) {
setUpdateEndpointUrl(uri.stringValue());
}
} catch (GraphUtilException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
示例3: setRepository
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
/**
* Configures the Repository (Connector for local/remote SPARQL repository) to use in Anno4j.
*
* @param repository Repository to use in Anno4j.
* @param conceptJars URLs of JAR-files that are scanned for concepts.
* @param behaviourJars URLs of JAR-files that are scanned for behaviours.
* @throws RepositoryException
* @throws RepositoryConfigException
*/
public void setRepository(Repository repository, Set<URL> conceptJars, Set<URL> behaviourJars) throws RepositoryException, RepositoryConfigException {
this.repository = repository;
// update alibaba wrapper
ObjectRepositoryFactory factory = new ObjectRepositoryFactory();
ObjectRepositoryConfig config = factory.getConfig();
for(URL conceptJar : conceptJars) {
config.addConceptJar(conceptJar);
}
for(URL behaviourJar : behaviourJars) {
config.addBehaviourJar(behaviourJar);
}
if(partialClasses != null) {
for(Class<?> clazz : this.partialClasses){
if (!clazz.getSimpleName().endsWith("AbstractClass")) {
config.addBehaviour(clazz);
}
}
}
this.objectRepository = new ObjectRepositoryFactory().createRepository(config, repository);
this.objectRepository.setIdGenerator(idGenerator);
}
示例4: ObjectParser
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
/**
* Basic constructor, which sets up all the necessary repositories.
*
* @throws RepositoryException
* @throws RepositoryConfigException
*/
public ObjectParser() throws RepositoryException, RepositoryConfigException {
this.anno4j = new Anno4j();
URIImpl[] motivations = new URIImpl[]{
new URIImpl(OADM.MOTIVATION_BOOKMARKING),
new URIImpl(OADM.MOTIVATION_CLASSIFYING),
new URIImpl(OADM.MOTIVATION_COMMENTING),
new URIImpl(OADM.MOTIVATION_DESCRIBING),
new URIImpl(OADM.MOTIVATION_EDITING),
new URIImpl(OADM.MOTIVATION_HIGHLIGHTING),
new URIImpl(OADM.MOTIVATION_IDENTIFYING),
new URIImpl(OADM.MOTIVATION_LINKING),
new URIImpl(OADM.MOTIVATION_MODERATING),
new URIImpl(OADM.MOTIVATION_QUESTIONING),
new URIImpl(OADM.MOTIVATION_REPLYING),
new URIImpl(OADM.MOTIVATION_TAGGING)
};
URIImpl obj = new URIImpl(OADM.MOTIVATION);
URIImpl pre = new URIImpl(RDF.TYPE);
for (URIImpl sub : motivations) {
StatementImpl statement = new StatementImpl(sub, pre, obj);
anno4j.getRepository().getConnection().add(statement);
}
}
示例5: resetQueryService
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Before
public void resetQueryService() throws RepositoryConfigException, RepositoryException, InstantiationException, IllegalAccessException {
this.anno4j = new Anno4j();
queryService = anno4j.createQueryService();
queryService.addPrefix("ex", "http://www.example.com/schema#");
// Persisting some data
Annotation annotation = anno4j.createObject(Annotation.class);
HashSet<Target> targets = new HashSet<>();
SpecificResource specificResource = anno4j.createObject(SpecificResource.class);
SpecificResource resource2 = anno4j.createObject(SpecificResource.class);
resource2.setSelector( anno4j.createObject(SvgSelector.class));
specificResource.setSelector(anno4j.createObject(FragmentSelector.class));
targets.add(specificResource);
targets.add(resource2);
annotation.setTargets(targets);
}
示例6: oneOrMoreTest
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Test
/**
* Test method for OneOrMorePath
*
* @see <a href="http://www.w3.org/TR/sparql11-query/#pp-language">http://www.w3.org/TR/sparql11-query/#pp-language</a>
*/
public void oneOrMoreTest() throws RepositoryException, QueryEvaluationException, MalformedQueryException, ParseException, RepositoryConfigException, IllegalAccessException, InstantiationException {
List<Annotation> annotations = queryService
.addCriteria("(oa:hasTarget)+")
.execute();
assertEquals(0, annotations.size());
super.setupUpQueryTest();
annotations = queryService
.addCriteria("(oa:hasBody)+")
.addCriteria("oa:hasBody/ex:recursiveBodyValue", "Another Testing Value")
.execute();
assertEquals(1, annotations.size());
assertEquals("Another Testing Value", ((RecursiveBody) annotations.get(0).getBodies().iterator().next()).getValue());
}
示例7: zeroOrMoreTest
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Test
/**
* Test method for ZeroOrMorePath.
*
* @see <a href="http://www.w3.org/TR/sparql11-query/#pp-language">http://www.w3.org/TR/sparql11-query/#pp-language</a>
*/
public void zeroOrMoreTest() throws RepositoryException, QueryEvaluationException, MalformedQueryException, ParseException, RepositoryConfigException, IllegalAccessException, InstantiationException {
List<Annotation> annotations = queryService.addCriteria("(oa:hasBody/ex:recursiveBodyValue)*", "Some Testing Value").execute();
assertEquals(1, annotations.size());
assertEquals("Some Testing Value", ((RecursiveBody) annotations.get(0).getBodies().iterator().next()).getValue());
super.setupUpQueryTest();
annotations = queryService.addCriteria("(oa:hasTarget)*").execute();
assertEquals(2, annotations.size());
}
示例8: testJSONLD
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Test
public void testJSONLD() throws UpdateExecutionException {
try {
URL url = new URL("http://example.com/");
ObjectParser objectParser = new ObjectParser();
List<Annotation> annotations = objectParser.parse(JSONLD, url, RDFFormat.JSONLD, true);
for(Annotation anno : annotations) {
System.out.println(anno.toString());
}
assertEquals(1, annotations.size());
objectParser.shutdown();
} catch (RepositoryException | MalformedURLException | RepositoryConfigException e) {
e.printStackTrace();
}
}
示例9: testTurtle
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Test
public void testTurtle() throws UpdateExecutionException {
try {
URL url = new URL("http://example.com/");
ObjectParser objectParser = new ObjectParser();
List<Annotation> annotations = objectParser.parse(TURTLE, url, RDFFormat.TURTLE, true);
for(Annotation anno : annotations) {
System.out.println(anno.toString());
}
assertEquals(1, annotations.size());
objectParser.shutdown();
} catch (IOException | RepositoryException | RepositoryConfigException e) {
e.printStackTrace();
}
}
示例10: testMultipleTurtle
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Test
public void testMultipleTurtle() throws UpdateExecutionException {
try {
URL url = new URL("http://example.com/");
ObjectParser objectParser = new ObjectParser();
List<Annotation> annotations = new LinkedList<>();
annotations.addAll(objectParser.parse(TURTLE, url, RDFFormat.TURTLE, true));
annotations.addAll(objectParser.parse(TURTLE2, url, RDFFormat.TURTLE, true));
annotations.addAll(objectParser.parse(TURTLE3, url, RDFFormat.TURTLE, true));
assertEquals(3, annotations.size());
for(Annotation anno : annotations) {
System.out.println(anno.toString());
}
objectParser.shutdown();
} catch (IOException | RepositoryException | RepositoryConfigException e) {
e.printStackTrace();
}
}
示例11: testMultipleInOneTurtle
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Test
public void testMultipleInOneTurtle() throws UpdateExecutionException {
try {
URL url = new URL("http://example.com/");
ObjectParser objectParser = new ObjectParser();
List<Annotation> annotations = objectParser.parse(TURTLE_MULTIPLE, url, RDFFormat.TURTLE, true);
assertEquals(3, annotations.size());
for(Annotation anno : annotations) {
System.out.println(anno.toString());
}
objectParser.shutdown();
} catch (IOException | RepositoryException | RepositoryConfigException e) {
e.printStackTrace();
}
}
示例12: validate
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
/**
* Validates this configuration. If the configuration is invalid a
* {@link StoreConfigException} is thrown including the reason why the
* configuration is invalid.
*
* @throws StoreConfigException
* If the configuration is invalid.
*/
@Override
public void validate() throws SailConfigException {
super.validate();
if (memberConfig.size() == 0) {
throw new SailConfigException("No federation members specified");
}
// validate all member repositories
for (RepositoryImplConfig cfg : memberConfig) {
try {
cfg.validate();
} catch (RepositoryConfigException e) {
throw new SailConfigException(e);
}
}
this.selectorConfig.validate();
this.optimizerConfig.validate();
}
示例13: getRepository
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Override
public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException
{
StardogRepository result = null;
if(config instanceof StardogRepositoryConfig)
{
StardogRepositoryConfig stardogConfig = (StardogRepositoryConfig)config;
try
{
stardogConfig.updateServerSettings(config);
}
catch(StardogException e)
{
throw new RuntimeException(e);
}
ConnectionConfiguration theConfig = stardogConfig.toConnectionConfiguration();
result = new StardogRepository(theConfig);
}
else
{
throw new RepositoryConfigException("Invalid configuration class: " + config.getClass());
}
return result;
}
示例14: DataStore
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
public DataStore( String rawstoreloc ) {
try {
setStoreLocation( rawstoreloc );
}
catch ( RepositoryException | RepositoryConfigException e ) {
log.fatal( e, e );
}
}
示例15: validate
import org.openrdf.repository.config.RepositoryConfigException; //导入依赖的package包/类
@Override
/**
* validate configuration
*
*/
public void validate() throws RepositoryConfigException {
super.validate();
if (getQueryEndpointUrl() == null) {
throw new RepositoryConfigException(
"No endpoint URL specified for SPARQL repository");
}
}