本文整理汇总了Java中com.hp.hpl.jena.ontology.OntDocumentManager类的典型用法代码示例。如果您正苦于以下问题:Java OntDocumentManager类的具体用法?Java OntDocumentManager怎么用?Java OntDocumentManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OntDocumentManager类属于com.hp.hpl.jena.ontology包,在下文中一共展示了OntDocumentManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findAllKnownImports
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
/**
* Method to find all known imports for a project. These include
* 1) SADL files
* 2) OWL files which are not associated with a SADL file
* 3) Listings in the ont-policy file which are not one of the above
* (Can't all of these just be gotten from the policy file?)
* @param someFileInProject
* @return
* @throws URISyntaxException
* @throws IOException
*/
public static List<String> findAllKnownImports(URI someFileInProject) throws IOException, URISyntaxException {
String policyFileUrl = getValidatedPolicyFileUrlForProject(someFileInProject);
if (policyFileUrl != null) {
OntDocumentManager mgr = OntDocumentManager.getInstance(); // new OntDocumentManager(policyFileUrl);
if (!mgr.getMetadataSearchPath().contains(policyFileUrl)) {
mgr.setMetadataSearchPath(policyFileUrl, true);
}
LocationMapper mapper = mgr.getFileManager().getLocationMapper();
Iterator<String> itr = mapper.listAltEntries();
if (itr.hasNext()) {
List<String> publicUris = new ArrayList<String>();
while (itr.hasNext()) {
String altEntry = itr.next();
String mapping = mapper.altMapping(altEntry);
logger.debug("Location Mapper AltEntry: " + altEntry + ", " + mapping);
publicUris.add(altEntry);
}
return publicUris;
}
}
return null;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:34,代码来源:ResourceManager.java
示例2: VocabularyHelper
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
VocabularyHelper(final Model model, final Module module) {
this.module=module;
final OntDocumentManager mgr = new OntDocumentManager();
mgr.setProcessImports(false);
final OntModelSpec spec=new OntModelSpec(OntModelSpec.OWL_MEM);
spec.setDocumentManager(mgr);
this.vocabulary=ModelFactory.createOntologyModel(spec,model);
}
开发者ID:SmartDeveloperHub,项目名称:sdh-vocabulary,代码行数:9,代码来源:VocabularyHelper.java
示例3: OntologyHandler
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public OntologyHandler() {
OntDocumentManager mgr = new OntDocumentManager();
mgr.setProcessImports(false);
OntModelSpec s = new OntModelSpec( OntModelSpec.OWL_MEM );
s.setDocumentManager( mgr );
ontModel = ModelFactory.createOntologyModel(s);
ontModel.setStrictMode(false);
}
开发者ID:therelaxist,项目名称:spring-usc,代码行数:10,代码来源:OntologyHandler.java
示例4: initialize
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
private void initialize(File rootDirectory, boolean recursive,
Set<String> extensions) throws FileNotFoundException {
if (rootDirectory.isDirectory()) {
autoURIMapper = new AutoURIMapper(rootDirectory, recursive);
if (extensions != null)
autoURIMapper.setFileExtensions(extensions);
documentManager = new OntDocumentManager();
documentManager.setReadFailureHandler(new FileImportNotFound());
autoURIMapper.update();
updateDocumentManager();
} else {
throw new FileNotFoundException(rootDirectory.toString());
}
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:15,代码来源:RemediatorWorkspace.java
示例5: loadMappingFile
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
protected synchronized void loadMappingFile() throws ConfigurationException {
if (getModelFolderPath() != null) {
String modelFolderPathname = getModelFolderPath().getAbsolutePath();
String mappingFilename = modelFolderPathname + File.separator + ONT_POLICY_RDF;
File mappingFile = new File(mappingFilename);
if (mappingFile.exists()) {
// load mapping info from file
setMappingModel(ModelFactory.createDefaultModel()) ;
InputStream in = FileManager.get().open(mappingFilename);
if (in == null) {
throw new IllegalArgumentException("File: " + mappingFilename + " not found");
}
try {
getMappingModel().read(in, "");
}
catch (Throwable t) {
t.printStackTrace();
logger.error("Failed to read mapping file in folder '" + modelFolderPathname + "': " + t.getLocalizedMessage());
}
finally {
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
else {
logger.warn("Model folder '" + modelFolderPathname + "' has no ont-policy.rdf file.");
}
}
else if (getModelFolderUrl() != null) {
setMappingModel(ModelFactory.createDefaultModel()) ;
getMappingModel().read(getModelFolderUrl() + "/" + ONT_POLICY_RDF);
}
setJenaDocumentMgr(new OntDocumentManager(getMappingModel()));
}
开发者ID:crapo,项目名称:sadlos2,代码行数:39,代码来源:ConfigurationManager.java
示例6: getJenaDocumentMgr
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public OntDocumentManager getJenaDocumentMgr() {
if (jenaDocumentMgr == null) {
if (getMappingModel() != null) {
setJenaDocumentMgr(new OntDocumentManager(getMappingModel()));
if (ontModelSpec != null) {
ontModelSpec.setDocumentManager(getJenaDocumentMgr());
}
}
else {
setJenaDocumentMgr(OntDocumentManager.getInstance());
}
}
return jenaDocumentMgr;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:15,代码来源:ConfigurationManager.java
示例7: setProjectFolderPath
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public void setProjectFolderPath(String _projectFolderPath, String _modelFolderPath) throws ConfigurationException {
if (projectFolderPath != null && !projectFolderPath.equals(_projectFolderPath)) {
// we are changing projects; reset the mappings and cached models
System.out.println("Project changing from '" + projectFolderPath + "' to '" + _projectFolderPath + "'");
OntDocumentManager.getInstance().reset(true);
init(_modelFolderPath);
}
projectFolderPath = _projectFolderPath;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:10,代码来源:ConfigurationManagerForIDE.java
示例8: getOntModel
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public OntModel getOntModel(String publicUri, Scope scope) throws ConfigurationException, IOException {
OntModel theModel = null;
String altUrl = getAltUrlFromPublicUri(publicUri);
if (repoType == null) {
repoType = ConfigurationManagerForIDE.getOWLFormat();
SadlJenaModelGetterPutter modelGetter = new SadlJenaModelGetterPutter(this, getTdbFolder(), repoType);
setModelGetter(modelGetter);
}
if (repoType != null && repoType.equals(IConfigurationManager.JENA_TDB)) {
try {
theModel = getModelGetter().getOntModel(publicUri, altUrl,
IConfigurationManager.JENA_TDB);
} catch (Throwable t) {
// ok to fail; may not exist
}
} else {
if (getModelGetter() != null) {
boolean resetProcessImports = false;
boolean processImports = OntDocumentManager.getInstance().getProcessImports();
if (scope != null && scope.equals(Scope.LOCALONLY) && processImports) {
OntDocumentManager.getInstance().setProcessImports(false);
resetProcessImports = true;
}
else if (!processImports) {
OntDocumentManager.getInstance().setProcessImports(true);
resetProcessImports = true;
}
theModel = getModelGetter().getOntModel(publicUri, altUrl, repoType);
if (resetProcessImports) {
OntDocumentManager.getInstance().setProcessImports(processImports);
}
}
}
return theModel;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:36,代码来源:ConfigurationManagerForIDE.java
示例9: loadMappingFile
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
protected synchronized void loadMappingFile() throws ConfigurationException {
if (getModelFolderPath() != null) {
String modelFolderPathname = getModelFolderPath().getAbsolutePath();
String mappingFilename = modelFolderPathname + File.separator + ONT_POLICY_RDF;
File mappingFile = new File(mappingFilename);
if (mappingFile.exists()) {
logger.debug("reading existing mapping model '" + mappingFilename + "'");
// load mapping info from file
setMappingModel(ModelFactory.createDefaultModel()) ;
InputStream in = FileManager.get().open(mappingFilename);
if (in == null) {
throw new IllegalArgumentException("File: " + mappingFilename + " not found");
}
try {
getMappingModel().read(in, "");
}
catch (Throwable t) {
t.printStackTrace();
logger.error("Failed to read mapping file in folder '" + modelFolderPathname + "': " + t.getLocalizedMessage());
}
}
else {
logger.warn("Model folder '" + modelFolderPathname + "' has no ont-policy.rdf file.");
}
}
else if (getModelFolderUrl() != null) {
logger.debug("creating new mapping model for '" + getModelFolderUrl() + "'");
setMappingModel(ModelFactory.createDefaultModel()) ;
getMappingModel().read(getModelFolderUrl() + "/" + ONT_POLICY_RDF);
}
setJenaDocumentMgr(new OntDocumentManager(getMappingModel()));
}
开发者ID:crapo,项目名称:sadlos2,代码行数:33,代码来源:ConfigurationManager.java
示例10: prepareEmptyOntModel
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
private OntModel prepareEmptyOntModel(String modelFolderPathname) throws ConfigurationException {
IConfigurationManagerForIDE cm = ConfigurationManagerForIdeFactory.getConfigurationManagerForIDE(modelFolderPathname, ConfigurationManagerForIDE.getOWLFormat());
OntDocumentManager owlDocMgr = cm.getJenaDocumentMgr();
OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_MEM);
setSpec(spec);
spec.setImportModelGetter(new SadlJenaModelGetterPutter(spec, modelFolderPathname));
spec.setDocumentManager(owlDocMgr);
owlDocMgr.setProcessImports(true);
return ModelFactory.createOntologyModel(spec);
}
开发者ID:crapo,项目名称:sadlos2,代码行数:11,代码来源:OwlToSadl.java
示例11: getJenaDocumentMgr
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public OntDocumentManager getJenaDocumentMgr(OntModelSpec ontModelSpec) {
if (jenaDocumentMgr == null) {
if (getMappingModel() != null) {
setJenaDocumentMgr(new OntDocumentManager(getMappingModel()));
if (ontModelSpec != null) {
ontModelSpec.setDocumentManager(jenaDocumentMgr);
}
} else {
setJenaDocumentMgr(OntDocumentManager.getInstance());
}
}
return jenaDocumentMgr;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:14,代码来源:JenaBasedSadlModelProcessor.java
示例12: initializeCache
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public static void initializeCache() {
if (!cacheInitialized) {
// cache the ontologies we use
OntDocumentManager.getInstance().addModel(oboe, ModelFactory.createOntologyModel().read(oboe));
OntDocumentManager.getInstance().addModel(oboe_sbc, ModelFactory.createOntologyModel().read(oboe_sbc));
OntDocumentManager.getInstance().addModel(oa, ModelFactory.createOntologyModel().read(oa_source));
OntDocumentManager.getInstance().addModel(dcterms, ModelFactory.createOntologyModel().read(dcterms_source));
OntDocumentManager.getInstance().addModel(foaf, ModelFactory.createOntologyModel().read(foaf_source));
OntDocumentManager.getInstance().addModel(prov, ModelFactory.createOntologyModel().read(prov));
//OntDocumentManager.getInstance().addModel(cito, ModelFactory.createOntologyModel().read(cito));
cacheInitialized = true;
}
}
开发者ID:DataONEorg,项目名称:annotator,代码行数:14,代码来源:AnnotationGenerator.java
示例13: run
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public void run() {
try {
log.info("Initializing gemet...");
OntDocumentManager ontManager = new OntDocumentManager();
OntModelSpec s = new OntModelSpec(OntModelSpec.OWL_MEM);
OntModel model = ontManager.getOntology(gemetFilePath, s);
context.setModel(model);
log.info("Gemet initialized.");
} catch (Exception ex) {
log.log(Level.SEVERE, "Gement initialization failed", ex);
}
}
开发者ID:mhogeweg,项目名称:OntologyService,代码行数:16,代码来源:ContextInitializer.java
示例14: open
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
@Override
public Object open( Assembler a, Resource root, Mode irrelevant )
{
checkType( root, JA.DocumentManager );
OntDocumentManager result = createDocumentManager();
result.setMetadataSearchPath( getPath( a, root ), false );
result.configure( ResourceUtils.reachableClosure( root ), false );
result.setFileManager( getFileManager( a, root ) );
return result;
}
开发者ID:jacekkopecky,项目名称:parkjam,代码行数:11,代码来源:DocumentManagerAssembler.java
示例15: setupModelSpecification
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
/**
* Setup a the OntModelSpec to be used when parsing services.
* In particular, setup import redirections, etc.
*
* @return
*/
private void setupModelSpecification() {
OntDocumentManager documentManager = new OntDocumentManager();
// Add mapping specific to OWLS TC 4 tests.
// Add mappings to local files to save time and avoid connection issues
documentManager.addAltEntry("http://127.0.0.1/ontology/PDDLExpression.owl", this.getClass().getResource("/PDDLExpression.owl").toString());
// Ignore all imports altogether for speed
documentManager.setProcessImports(false);
this.modelSpec = new OntModelSpec(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
this.modelSpec.setDocumentManager(documentManager);
}
开发者ID:kmi,项目名称:msm4j,代码行数:21,代码来源:OwlsTransformer.java
示例16: getDocumentManager
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public OntDocumentManager getDocumentManager() {
return documentManager;
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:4,代码来源:RemediatorWorkspace.java
示例17: initializeReasoner
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public int initializeReasoner(String folderName, String _modelName,
List<ConfigurationItem> _preferences, String _repoType) throws ReasonerNotFoundException, ConfigurationException {
preferences = _preferences;
repoType = _repoType;
setModelName(_modelName);
if (timingInfo == null) {
timingInfo = new ArrayList<ReasonerTiming>();
}
else {
timingInfo.clear();
}
tboxLoadTime = System.currentTimeMillis();
if (configurationMgr == null) {
// Get the correct Mappings from the policy file
OntDocumentManager mgr = OntDocumentManager.getInstance();
mgr.reset();
// mgr.setProcessImports(true);
configurationMgr = ConfigurationManagerFactory.getConfigurationManager(folderName, repoType);
}
//Get the real tbox and rule file path
tbox = configurationMgr.getAltUrlFromPublicUri(getModelName());
if (tbox == null) {
throw new ConfigurationException("No mapping to an actual URL found for model '" + getModelName() + "'.");
}
String format = repoType;
try {
String tdbFolder = configurationMgr.getTdbFolder();
if (configurationMgr.getModelGetter() == null) {
configurationMgr.setModelGetter(new SadlJenaModelGetter(configurationMgr, tdbFolder));
}
format = configurationMgr.getModelGetter().getFormat();
if (!format.equals(IConfigurationManager.JENA_TDB)) {
String ext = tbox.substring(tbox.lastIndexOf('.'));
format = "RDF/XML-ABBREV"; // this will create a reader that will handle either RDF/XML or RDF/XML-ABBREV
if (ext.equalsIgnoreCase(".n3")) {
format = "N3";
}
else if (ext.equalsIgnoreCase(".ntriple") || ext.equalsIgnoreCase(".nt")) {
format = "N-TRIPLE";
}
configurationMgr.getModelGetter().setFormat(format);
}
}
catch (IOException e) {
e.printStackTrace();
}
initialized = true;
return 1;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:57,代码来源:JenaReasonerPlugin.java
示例18: getJenaDocumentMgr
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public OntDocumentManager getJenaDocumentMgr() {
// Note: for an editing configuration manager,
// the OntDocumentManager must be set explicitly
return jenaDocumentMgr;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:6,代码来源:ConfigurationManagerForEditing.java
示例19: setJenaDocumentMgr
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
private void setJenaDocumentMgr(OntDocumentManager jenaDocumentMgr) {
this.jenaDocumentMgr = jenaDocumentMgr;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:4,代码来源:ConfigurationManager.java
示例20: initializeReasoner
import com.hp.hpl.jena.ontology.OntDocumentManager; //导入依赖的package包/类
public int initializeReasoner(String folderName, String _modelName,
List<ConfigurationItem> _preferences, String _repoType) throws ReasonerNotFoundException, ConfigurationException {
preferences = _preferences;
repoType = _repoType;
setModelName(_modelName);
if (timingInfo == null) {
timingInfo = new ArrayList<ReasonerTiming>();
}
else {
timingInfo.clear();
}
tboxLoadTime = System.currentTimeMillis();
if (configurationMgr == null) {
// Get the correct Mappings from the policy file
OntDocumentManager mgr = OntDocumentManager.getInstance();
mgr.reset();
mgr.setProcessImports(true);
configurationMgr = ConfigurationManagerFactory.getConfigurationManager(folderName, repoType);
}
//Get the real tbox and rule file path
tbox = configurationMgr.getAltUrlFromPublicUri(getModelName());
if (tbox == null) {
throw new ConfigurationException("No mapping to an actual URL found for model '" + getModelName() + "'.");
}
String format = repoType;
try {
String tdbFolder = configurationMgr.getTdbFolder();
if (configurationMgr.getModelGetter() == null) {
configurationMgr.setModelGetter(new SadlJenaModelGetter(configurationMgr, tdbFolder));
}
format = configurationMgr.getModelGetter().getFormat();
if (!format.equals(IConfigurationManager.JENA_TDB)) {
String ext = tbox.substring(tbox.lastIndexOf('.'));
format = ConfigurationManager.RDF_XML_ABBREV_FORMAT; // this will create a reader that will handle either RDF/XML or RDF/XML-ABBREV
if (ext.equalsIgnoreCase(".n3")) {
format = "N3";
}
else if (ext.equalsIgnoreCase(".ntriple") || ext.equalsIgnoreCase(".nt")) {
format = "N-TRIPLE";
}
configurationMgr.getModelGetter().setFormat(format);
}
}
catch (IOException e) {
e.printStackTrace();
}
initialized = true;
return 1;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:57,代码来源:JenaReasonerPlugin.java
注:本文中的com.hp.hpl.jena.ontology.OntDocumentManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论