当前位置: 首页>>代码示例>>Java>>正文


Java OWLOntology类代码示例

本文整理汇总了Java中org.semanticweb.owlapi.model.OWLOntology的典型用法代码示例。如果您正苦于以下问题:Java OWLOntology类的具体用法?Java OWLOntology怎么用?Java OWLOntology使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OWLOntology类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLOntology类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: OntologyBrowser

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
public OntologyBrowser(OWLOntology ontology, Set<String> rootsToRemove) {
  super();
  this.ontology = ontology;
  this.rootConcept = "Thing";
  this.buildTreeModel();
  for (String concept : rootsToRemove) {
    DefaultMutableTreeNode node = getNodeFromName(concept);
    this.dtm.removeNodeFromParent(node);
  }

  this.setModel(this.dtm);
  // set the tree selection model
  DefaultTreeSelectionModel dtsm = new DefaultTreeSelectionModel();
  dtsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  this.setSelectionModel(dtsm);
  // set the tree renderer
  OntologyRenderer myRenderer = new OntologyRenderer();
  this.setCellRenderer(myRenderer);
  this.setRootVisible(false);
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:21,代码来源:OntologyBrowser.java

示例2: export

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
@UITopiaVariant(
  author = "onprom team",
  affiliation = "Free University of Bozen-Bolzano",
  email = "[email protected]",
  website = "http://onprom.inf.unibz.it"
)
@PluginVariant(requiredParameterLabels = {0, 1})
public void export(PluginContext context, OWLOntology ontology, File file) {
  try {
    //default format is RDF/XML format for the ontology
    RDFDocumentFormat format = new RDFXMLDocumentFormat();
    //save the given ontology using the format to the file
    OWLManager.createOWLOntologyManager().saveOntology(ontology, format, new FileOutputStream(file));
    context.log("Exported ontology to the file: " + file.getName());
  } catch (Exception e) {
    context.log("Couldn't export ontology to the file: " + file.getName() + " ->" + e.getMessage());
  }
}
 
开发者ID:onprom,项目名称:onprom,代码行数:19,代码来源:OWLOntologyExportPlugin.java

示例3: importFromStream

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
@UITopiaVariant(
  author = "onprom team",
  affiliation = "Free University of Bozen-Bolzano",
  email = "[email protected]",
  website = "http://onprom.inf.unibz.it"
)
@Override
protected OWLOntology importFromStream(final PluginContext context, final InputStream input, final String filename,
                                       final long fileSizeInBytes) {
  try {
    context.getFutureResult(0).setLabel("OWL ontology imported from " + filename);
    return OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument(input);
  } catch (final Throwable e) {
    context.log("Couldn't import ontology:" + e.getMessage(), Logger.MessageLevel.ERROR);
  }
  return null;
}
 
开发者ID:onprom,项目名称:onprom,代码行数:18,代码来源:OWLOntologyImportPlugin.java

示例4: open

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
public static LoadedObjects open(File selectedFile, FileType... allowedFileType) {
    if (selectedFile == null) {
        selectedFile = IOUtility.selectFileToOpen(allowedFileType);
    }
    switch (IOUtility.getFileType(selectedFile)) {
        case ONTOLOGY:
            OWLOntology ontology = OWLImporter.loadOntologyFromFile(selectedFile);
            if (ontology != null) {
                return new LoadedObjects(selectedFile, ontology, OWLImporter.getShapes(ontology));
            }
            break;
        case ANNOTATION:
        case UML:
        case QUERIES:
        case JSON:
            return new LoadedObjects(selectedFile, null, IOUtility.importJSON(selectedFile));
    }
    return null;
}
 
开发者ID:onprom,项目名称:onprom,代码行数:20,代码来源:IOUtility.java

示例5: extractXESLog

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * Generates XES log based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return event log - XLog
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 * @deprecated this one is only maintained for backward compatibility with the other OnProm plug in, at some point it should be removed
 */
@Deprecated
public static XLog extractXESLog(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{

	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelNaiveImpl ebdaModel = leFact.createEBDAModelNaiveImpl();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	//add new mapping based on the annotation information
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));

	return extractXESLog(ebdaModel);
}
 
开发者ID:onprom,项目名称:onprom,代码行数:40,代码来源:XESLogExtractorExperimental.java

示例6: createEBDAModelNaiveImpl

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * Generates EBDA Model based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return EBDA Model
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 */
public EBDAModelNaiveImpl createEBDAModelNaiveImpl(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{
	
	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelNaiveImpl ebdaModel = leFact.createEBDAModelNaiveImpl();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	//add new mapping based on the annotation information
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));
	
	return ebdaModel;	
}
 
开发者ID:onprom,项目名称:onprom,代码行数:38,代码来源:XESLogExtractorExperimental.java

示例7: createEBDAModelImpl2

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * Generates EBDA Model based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return EBDA Model
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 */
public EBDAModelImpl2 createEBDAModelImpl2(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{
	
	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelImpl2 ebdaModel = leFact.createEBDAModelImpl2();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	//add new mapping based on the annotation information
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));
	
	return ebdaModel;	
}
 
开发者ID:onprom,项目名称:onprom,代码行数:38,代码来源:XESLogExtractorExperimental.java

示例8: createEBDAModelImpl3

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * Generates EBDA Model based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return EBDA Model
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 */
public EBDAModelImpl3 createEBDAModelImpl3(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{
	
	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelImpl3 ebdaModel = leFact.createEBDAModelImpl3();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	//add new mapping based on the annotation information
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));
	
	return ebdaModel;	
}
 
开发者ID:onprom,项目名称:onprom,代码行数:38,代码来源:XESLogExtractorExperimental.java

示例9: createEBDAModelWithOptimizedXAttributesEncoding

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * Generates EBDA Model based on the given inputs, namely: 
 * Domain Ontology, OBDA Model, and annotation information
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param domainOntology
 * @param obdaModel
 * @param annotation
 * @return EBDA Model
 * @throws InvalidDataSourcesNumberException 
 * @throws OWLException 
 * @throws InvalidAnnotationException 
 * @throws XESLogExtractionFailureException 
 */
public EBDAModelWithOptimizedXAttributesEncoding createEBDAModelWithOptimizedXAttributesEncoding(OWLOntology domainOntology, OBDAModel obdaModel, AnnotationQueries annotation) 
		throws InvalidDataSourcesNumberException, InvalidAnnotationException, OWLException, XESLogExtractionFailureException, OBDAException, MalformedQueryException{
	
	List<OBDADataSource> odsList = obdaModel.getSources();
	if(odsList.size() > 1)
		throw new InvalidDataSourcesNumberException(odsList.size());
	
	//Construct EBDA Model
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Start constucting an EBDA Model"));
	LEObjectFactory leFact = LEObjectFactory.getInstance();
	EBDAModelWithOptimizedXAttributesEncoding ebdaModel = leFact.createEBDAModelWithOptimizedXAttributesEncoding();
	
	//add data source information to the EBDA Model
	ebdaModel.addSource(odsList.get(0));
	
	//add new mapping based on the annotation information
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Construct the mappings for the EBDA Model"));
	ebdaModel.addMapping(domainOntology, obdaModel, annotation);
	
	logger.info(String.format(LEConstants.LOG_INFO_TEMPLATE, "Finish constucting an EBDA Model"));
	
	return ebdaModel;	
}
 
开发者ID:onprom,项目名称:onprom,代码行数:38,代码来源:XESLogExtractorExperimental.java

示例10: createSQLGeneratorExt

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
private SQLGeneratorExt createSQLGeneratorExt(OWLOntology ontology, OBDAModel inputOBDAModel) throws InvalidDataSourcesNumberException {

		//Get the data source
			Collection<OBDADataSource> sources = inputOBDAModel.getSources();
			if (sources == null || !(sources.size() == 1))
				throw new InvalidDataSourcesNumberException(sources.size());
			OBDADataSource obdaSource = sources.iterator().next();
		//END OF Get the data source

		DBMetadata metadata = this.getDBMetadata();
		String jdbcClassName = obdaSource.getParameter(RDBMSourceParameterConstants.DATABASE_DRIVER);
		String jdbcDatabaseName = metadata.getDbmsVersion();
		
	    SQLDialectAdapter sqladapter = SQLAdapterFactory.getSQLDialectAdapter(jdbcClassName, jdbcDatabaseName);
			
		return new SQLGeneratorExt(metadata, sqladapter, this.isSqlGenerateReplace(), this.hasDistinctResultSet(), this.getUriMap());
	}
 
开发者ID:onprom,项目名称:onprom,代码行数:18,代码来源:QuestOWLReasonerExt.java

示例11: fromOntology

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * Returns a list of rules extracted from the given OWL-2 ontology document.
 * 
 * @param src an ontology document
 * @return a list of rules
 */
public static List<Rule> fromOntology(OWLOntologyDocumentSource src) {
	try {
		// use OWL-API to get a OWLOntology document from source
		OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
		manager.loadOntologyFromOntologyDocument(src);
		Set<OWLOntology> ontologies = manager.getOntologies();
		if (ontologies.isEmpty()) {
			return Collections.EMPTY_LIST;
		} else {
			// use first ontology from given source
			return fromOntology(ontologies.iterator().next());
		}
	} catch (OWLOntologyCreationException ex) {
		throw new IllegalArgumentException(
				"Loading ontology stream failed", ex);
	}
}
 
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:24,代码来源:Rules.java

示例12: getOntologyFromName

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * Open the OWL ontology (from the ontology resources of CartAGen) whose name
 * is passed as parameter.
 * @param name
 * @return
 * @throws OWLOntologyCreationException
 */
public static OWLOntology getOntologyFromName(String name)
    throws OWLOntologyCreationException {
  // create the URI from the name and the CartAGen ontologies folder path
  String uri = FOLDER_PATH + "/" + name + ".owl";
  InputStream stream = OwlUtil.class.getResourceAsStream(uri);
  File file = new File(stream.toString());
  String path = file.getAbsolutePath().substring(0,
      file.getAbsolutePath().lastIndexOf('\\'));
  path = path.replaceAll(new String("\\\\"), new String("//"));
  path = path + "//src/main//resources//ontologies//" + name + ".owl";
  // create the ontology from the URI using an OWLOntologyManager
  OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
  IRI physicalURI = IRI.create(new File(path));
  OWLOntology ontology = manager
      .loadOntologyFromOntologyDocument(physicalURI);

  return ontology;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:26,代码来源:OwlUtil.java

示例13: train

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * Train on resources of a given class.
 * 
 * @param filename
 * @param strategy
 * @param classname
 * @return
 */
public static R2VModel train(String filename,
		TfidfFEXStrategy strategy, String classname) {
	
	OWLOntology o = getOntology(filename);
	R2VModel model = new R2VModel(o, strategy);
	
	for(OWLIndividual ind : getIndividuals(classname, o)) {
		model.add(ind.asOWLNamedIndividual());
	}
	
	model.stringFeatures();
	model.normalize();
	
	return model;
}
 
开发者ID:AKSW,项目名称:Resource2Vec,代码行数:24,代码来源:R2VManager.java

示例14: getOntology

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * @param filename
 * @return
 */
private static OWLOntology getOntology(String filename) {
	File file = new File(filename);
	
	OWLOntologyManager m = OWLManager.createOWLOntologyManager();

	OWLOntology o;
	try {
		o = m.loadOntologyFromOntologyDocument(IRI.create(file.toURI()));
	} catch (OWLOntologyCreationException e) {
		fail("Cannot load ontology.");
		return null;
	}
	assertNotNull(o);

	return o;
}
 
开发者ID:AKSW,项目名称:Resource2Vec,代码行数:21,代码来源:R2VManager.java

示例15: getIndividuals

import org.semanticweb.owlapi.model.OWLOntology; //导入依赖的package包/类
/**
 * @param superclass
 * @param o
 * @return
 */
private static Set<OWLIndividual> getIndividuals(String superclass,
		OWLOntology o) {
	
	OWLReasoner reasoner = PelletReasonerFactory.getInstance()
			.createReasoner(o);
	Set<OWLNamedIndividual> instances = reasoner.getInstances(
			OWL.Class(IRI.create(superclass)), false).getFlattened();
	
	// filter out all owl:sameAs instances...
	Set<OWLIndividual> ind = new TreeSet<>();
	for (OWLNamedIndividual i : instances) {
		ind.add(i);
	}
	logger.info("|I| = " + ind.size());
	logger.debug("I = " + ind);

	return ind;

}
 
开发者ID:AKSW,项目名称:Resource2Vec,代码行数:25,代码来源:R2VManager.java


注:本文中的org.semanticweb.owlapi.model.OWLOntology类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。