本文整理汇总了Java中org.semanticweb.owlapi.util.SimpleShortFormProvider类的典型用法代码示例。如果您正苦于以下问题:Java SimpleShortFormProvider类的具体用法?Java SimpleShortFormProvider怎么用?Java SimpleShortFormProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleShortFormProvider类属于org.semanticweb.owlapi.util包,在下文中一共展示了SimpleShortFormProvider类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: QueryingWithNamedClasses
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
public QueryingWithNamedClasses() throws OWLOntologyCreationException {
// Traditional setup with the OWL-API
manager = OWLManager.createOWLOntologyManager();
IRI ontologyIri = IRI.create(EL_ONTOLOGY);
ontology = manager.loadOntologyFromOntologyDocument(ontologyIri);
System.out.println("Loaded ontology: " + ontology.getOntologyID());
// But we use the Elk reasoner (add it to the classpath)
reasonerFactory = new ElkReasonerFactory();
reasoner = reasonerFactory.createReasoner(ontology);
// IMPORTANT: Precompute the inferences beforehand, otherwise no results
// will be returned
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
// Ontologies are not easy to query with the full name of concept, so we
// keep only the interesting bit ( = shortform)
shortFormProvider = new SimpleShortFormProvider();
Set<OWLOntology> importsClosure = ontology.getImportsClosure();
mapper = new BidirectionalShortFormProviderAdapter(manager,
importsClosure, shortFormProvider);
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:22,代码来源:QueryingWithNamedClasses.java
示例2: OntologyModel
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
public OntologyModel(MainFrame frame) throws OWLOntologyCreationException {
this.frame = frame;
this.owlFile = new File("ontology.owl");
this.iri = IRI.create("http://www.medicalsemantic.com");
this.dataFactory = OWLManager.getOWLDataFactory();
this.manager = OWLManager.createOWLOntologyManager();
this.ontology = manager.loadOntologyFromOntologyDocument(owlFile);
this.owlReasoner = createReasoner(ontology);
this.shortFormProvider = new SimpleShortFormProvider();
this.queryEngine = new DLQueryEngine(owlReasoner, shortFormProvider);
this.queryPrinter = new DLQueryPrinter(queryEngine, shortFormProvider);
this.queryParser = new DLQueryParser(ontology, shortFormProvider);
refreshSymptoms();
refreshDiseases();
}
开发者ID:UyumazHakan,项目名称:SemanticMedic,代码行数:17,代码来源:OntologyModel.java
示例3: getNextPossibleSymptom
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
public String getNextPossibleSymptom() {
OWLClass disease = model.getClass("Disease");
OWLObjectUnionOf allDiseases = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(disease));
OWLObjectIntersectionOf intersectionOfSelected = getIntersectionOfSelected();
OWLObjectUnionOf unionOfSubSelected = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(intersectionOfSelected));
OWLObjectIntersectionOf possibleDiseasesIntersection = model.getDataFactory().getOWLObjectIntersectionOf(allDiseases, unionOfSubSelected);
Set<OWLClass> possibleDiseases = model.getSubOfExpression(possibleDiseasesIntersection);
possibleDiseases.addAll(model.getEquivalentOfExpression(possibleDiseasesIntersection));
possibleDiseases.remove(model.getDataFactory().getOWLNothing());
Set<OWLClass> possibleSymptoms = new TreeSet<OWLClass>();
Iterator<OWLClass> possibleDiseasesIterator = possibleDiseases.iterator();
while (possibleDiseasesIterator.hasNext()) {
OWLClass next = possibleDiseasesIterator.next();
possibleSymptoms.addAll(model.getSuperOfExpression(next));
}
possibleSymptoms.remove(model.getDataFactory().getOWLThing());
possibleSymptoms.remove(model.getClass("Disease"));
possibleSymptoms.removeAll(selectedSymptoms);
possibleSymptoms.removeAll(notSelectedSymptoms);
System.out.println(possibleDiseases);
if(possibleSymptoms.size()!=0 && possibleDiseases.size()>1)
return (new SimpleShortFormProvider().getShortForm((OWLClass)possibleSymptoms.toArray()[0])).substring(7);
else
return null;
}
开发者ID:UyumazHakan,项目名称:SemanticMedic,代码行数:27,代码来源:DiseaseQueryMaker.java
示例4: getPossibleDisease
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
public String getPossibleDisease(){
OWLClass disease = model.getClass("Disease");
OWLObjectUnionOf allDiseases = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(disease));
OWLObjectIntersectionOf intersectionOfSelected = getIntersectionOfSelected();
OWLObjectUnionOf unionOfSubSelected = model.getDataFactory().getOWLObjectUnionOf(model.getSubOfExpression(intersectionOfSelected));
OWLObjectIntersectionOf possibleDiseasesIntersection = model.getDataFactory().getOWLObjectIntersectionOf(allDiseases, unionOfSubSelected);
Set<OWLClass> possibleDiseases = model.getSubOfExpression(possibleDiseasesIntersection);
possibleDiseases.addAll(model.getEquivalentOfExpression(possibleDiseasesIntersection));
possibleDiseases.remove(model.getDataFactory().getOWLNothing());
String value="";
if(possibleDiseases.size()!=0) {
Iterator<OWLClass> it = possibleDiseases.iterator();
while (it.hasNext()) {
value+="\n"+new SimpleShortFormProvider().getShortForm(it.next());
}
}else
value+="\nCould not found";
return value;
}
开发者ID:UyumazHakan,项目名称:SemanticMedic,代码行数:20,代码来源:DiseaseQueryMaker.java
示例5: initMapsAndSFPs
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
/**
* Initialise labels and gensyms maps, and short form providers
*/
private void initMapsAndSFPs() {
try {
this.docBuilder = dbfac.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
df = ont1.getOWLOntologyManager().getOWLDataFactory();
genSymMap = new HashMap<OWLEntity,String>();
labelMap = new HashMap<OWLEntity, String>();
sf = new SimpleShortFormProvider();
generateGenSyms(); // Prep gen syms output
mapLabels(ont1); mapLabels(ont2); // Prep labels output
gp = new GenSymShortFormProvider(genSymMap);
lp = new LabelShortFormProvider(labelMap);
}
开发者ID:rsgoncalves,项目名称:ecco,代码行数:19,代码来源:XMLAxiomDiffReport.java
示例6: dlQuery
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
/**
* Execute a DL-Query and retrieve it result (subclasses)
*
* @param query The query
* @return All sublasses returned by the query
*/
private List<String> dlQuery(String query, boolean directSublasses) {
List<String> subclasses = new ArrayList<>();
ShortFormProvider shortFormProvider = new SimpleShortFormProvider(); // Do we really need that ?
DLQueryParser parser = new DLQueryParser(mOntology, shortFormProvider);
OWLClassExpression classExpression = null;
try {
classExpression = parser.parseClassExpression(query);
} catch (ParserException e) {
e.printStackTrace();
}
NodeSet<OWLClass> subClasses = mReasoner.getSubClasses(classExpression, directSublasses);
for (Node<?> sport : subClasses.getNodes()) {
Set<?> sportEntity = sport.getEntities();
if (!sportEntity.isEmpty()) {
OWLClass entity = ((OWLClass) sportEntity.iterator().next());
if (!entity.isOWLNothing()) { // Return an empty list if no subclasses are found
subclasses.add(entity.getIRI().getFragment());
}
}
}
return subclasses;
}
开发者ID:pschmitt,项目名称:hochschulsport,代码行数:29,代码来源:OntologyProvider.java
示例7: getShortForm
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
@Override
public String getShortForm(OWLEntity arg0) {
String output = "";
SimpleShortFormProvider fp = new SimpleShortFormProvider();
if(map.get(arg0) != null)
output = map.get(arg0);
else
output = fp.getShortForm(arg0);
return output;
}
开发者ID:rsgoncalves,项目名称:ecco,代码行数:11,代码来源:GenSymShortFormProvider.java
示例8: LabelShortFormProvider
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
/**
* Constructor
* @param map Map of entities to labels
*/
public LabelShortFormProvider(HashMap<OWLEntity,String> map) {
this.map = map;
fp = new SimpleShortFormProvider();
}
开发者ID:rsgoncalves,项目名称:ecco,代码行数:9,代码来源:LabelShortFormProvider.java
示例9: XMLConceptDiffReport
import org.semanticweb.owlapi.util.SimpleShortFormProvider; //导入依赖的package包/类
/**
* Constructor
* @param changeSet Concept diff change set
*/
public XMLConceptDiffReport(ConceptChangeSet changeSet) {
this.changeSet = changeSet;
sf = new SimpleShortFormProvider();
dbfac = DocumentBuilderFactory.newInstance();
}
开发者ID:rsgoncalves,项目名称:ecco,代码行数:10,代码来源:XMLConceptDiffReport.java
注:本文中的org.semanticweb.owlapi.util.SimpleShortFormProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论