本文整理汇总了Java中org.openrdf.repository.manager.RepositoryManager类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryManager类的具体用法?Java RepositoryManager怎么用?Java RepositoryManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryManager类属于org.openrdf.repository.manager包,在下文中一共展示了RepositoryManager类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
@Override
public void connect() {
try {
RepositoryManager repoManager = new RemoteRepositoryManager(serverUrl);
repoManager.initialize();
Repository repo = repoManager.getRepository(repositoryId);
repoConnection = repo.getConnection();
repoConnection.setAutoCommit(true);
} catch (Exception ex) {
throw new RuntimeException("Failed to connect", ex);
}
logger.debug("Connected.");
}
示例2: testFileURI
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
public void testFileURI() throws Exception {
File dir = FileUtil.createTempDir(RepositoryProviderTest.class.getSimpleName());
try {
RepositoryManager byfile = RepositoryProvider.getRepositoryManager(dir);
RepositoryManager byurl = RepositoryProvider.getRepositoryManager(dir.toURI().getRawPath());
try {
assertEquals(byfile, byurl);
} finally {
byfile.shutDown();
byurl.shutDown();
}
} finally {
FileUtil.deleteDir(dir);
}
}
示例3: getInfo
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
@Override
public final Collection<?> getInfo() {
RepositoryManager manager = null;
try {
manager = RepositoryProvider.getRepositoryManager(sesameServer);
Collection<RepositoryInfo> infos =
manager.getAllRepositoryInfos(true);
return infos;
} catch (RepositoryConfigException | RepositoryException e) {
logger.error("Exception in Sesame getInfo()", e);
}
return null;
}
示例4: unimport
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
@Override
public final boolean unimport(final TaskInfo taskInfo,
final JsonNode subtask,
final HashMap<String, String> results) {
// Remove the sesameDownload access point.
AccessPointUtils.deleteAccessPointsForVersionAndType(
taskInfo.getVersion(), AccessPoint.SESAME_DOWNLOAD_TYPE);
// Remove the apiSparql access point.
AccessPointUtils.deleteAccessPointsForVersionAndType(
taskInfo.getVersion(), AccessPoint.API_SPARQL_TYPE);
// Remove the repository from the Sesame server.
RepositoryManager manager = null;
try {
manager = RepositoryProvider.getRepositoryManager(sesameServer);
String repositoryID = ToolkitFileUtils.getSesameRepositoryId(
taskInfo);
Repository repository = manager.getRepository(repositoryID);
if (repository == null) {
// No such repository; nothing to do.
logger.debug("Sesame unimport: nothing to do.");
return true;
}
manager.removeRepository(repositoryID);
// Seems to be necessary to invoke refresh() to make
// the manager "forget" about the repository.
// Without it, if you immediately reimport,
// createRepository's call to getRepository() wrongly reports
// that the repository already exists, and the subsequent
// importing of data fails.
manager.refresh();
// If we're still here, success, so return true.
return true;
} catch (RepositoryConfigException | RepositoryException e) {
results.put(TaskStatus.EXCEPTION,
"Exception in Sesame unimport");
logger.error("Exception in Sesame unimport", e);
}
return false;
}
示例5: setManager
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
private void setManager(RepositoryManager manager, String location) {
logger.debug("setManager called");
try {
disconnect();
manager.initialize();
mRepositoryManager = manager;
mRepositoryLocation = location;
} catch (RepositoryException e) {
throw new SesameManagerException("Error initializing manager: "+e);
}
}
示例6: getRepositoryManager
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
public RepositoryManager getRepositoryManager() {
return repositoryManager;
}
示例7: createRepository
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
/** Create the repository within Sesame.
* @param taskInfo The TaskInfo object describing the entire task.
* @param results HashMap representing the result of the task.
* @return True, iff the repository creation succeeded.
*/
public final boolean createRepository(final TaskInfo taskInfo,
final HashMap<String, String> results) {
RepositoryManager manager = null;
try {
manager = RepositoryProvider.getRepositoryManager(sesameServer);
String repositoryID = ToolkitFileUtils.getSesameRepositoryId(
taskInfo);
String versionID = taskInfo.getVersion().getTitle();
String repositoryTitle = taskInfo.getVocabulary().getTitle()
+ " (Version: " + versionID + ")";
Repository repository = manager.getRepository(repositoryID);
if (repository != null) {
// Already exists.
// Possible future work: see if the vocabulary title
// has changed in the database, and if so, update
// the title in the Sesame repository.
logger.debug("Sesame createRepository: already exists; "
+ "reusing");
return true;
}
// create a configuration for the SAIL stack
SailImplConfig backendConfig;
if ("current".equals(versionID)) {
// Create an in-memory store for higher performance.
boolean persist = true;
backendConfig = new MemoryStoreConfig(persist);
} else {
// Create a native store.
boolean forceSync = true;
NativeStoreConfig nativeConfig = new NativeStoreConfig();
nativeConfig.setForceSync(forceSync);
backendConfig = nativeConfig;
}
// Stack an inferencer config on top of our backend-config.
backendConfig =
new ForwardChainingRDFSInferencerConfig(backendConfig);
// Create a configuration for the repository implementation.
RepositoryImplConfig repositoryTypeSpec =
new SailRepositoryConfig(backendConfig);
RepositoryConfig repConfig =
new RepositoryConfig(repositoryID, repositoryTitle,
repositoryTypeSpec);
manager.addRepositoryConfig(repConfig);
return true;
} catch (RepositoryConfigException | RepositoryException e) {
results.put(TaskStatus.EXCEPTION,
"Exception in Sesame createRepository()");
logger.error("Exception in Sesame createRepository()", e);
}
return false;
}
示例8: OwlimSemanticRepositoryManagedConnection
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
/**
* Creates a new managed connection.
*
* @param repositoryManager
* repository manager
* @param repository
* OWLIM repository created by the resource adapter
* @param cxRequestInfo
* parameters of connection
* @throws SemanticRepositoryResourceException
* if some IO exception occurred
*/
public OwlimSemanticRepositoryManagedConnection(RepositoryManager repositoryManager, Repository repository,
OwlimSemanticRepositoryConnectionRequestInfo cxRequestInfo)
throws SemanticRepositoryResourceException {
super(cxRequestInfo.isdArceo());
logger.debug("OwlimSemanticRepositoryConnectionRequestInfo: " + cxRequestInfo);
this.repositoryManager = repositoryManager;
this.client = new OwlimSemanticRepositoryClient(repository);
this.client.connect();
xares = new OwlimSemanticRepositoryXAResource(operations, client);
}
示例9: setRepositoryManager
import org.openrdf.repository.manager.RepositoryManager; //导入依赖的package包/类
/**
* set the Repository Manager.
*
* currenttly this function is not called since cumulusRDF server only support one Repository at the moment
* @param repMan the RepositoryManager object
*/
public void setRepositoryManager(final RepositoryManager repMan) {
_repositoryManager = repMan;
}