本文整理汇总了Java中org.semanticweb.owlapi.model.AxiomType类的典型用法代码示例。如果您正苦于以下问题:Java AxiomType类的具体用法?Java AxiomType怎么用?Java AxiomType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AxiomType类属于org.semanticweb.owlapi.model包,在下文中一共展示了AxiomType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: done
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
@Override
public void done() {
if(!isCancelled()){
// stop timer
if(timer != null) {
timer.cancel();
}
// show results
if(view.getAxiomType().equals(AxiomType.EQUIVALENT_CLASSES) || view.getAxiomType().equals(AxiomType.SUBCLASS_OF)) {
List<EvaluatedDescriptionClass> result = Manager.getInstance().getCurrentlyLearnedDescriptions();
updateList(result);
}
// show that leaning has been finished
view.setLearningFinished();
setProgress(0);
}
ProtegeApplication.getBackgroundTaskManager().endTask(learningTask);
}
示例2: deleteFactCommand
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
@Deprecated
public void deleteFactCommand() throws IOException, OWLOntologyCreationException, OWLOntologyStorageException, UnknownOWLClassException {
if (isHelp()) {
info("generates ClassAssertion");
return;
}
OWLOntology ont = resolveOntology(Param.ontology);
OWLIndividual i = resolveIndividual(Param.individualId);
OWLIndividual j = resolveIndividual(Param.fillerId);
OWLObjectProperty p = resolveObjectProperty(Param.propertyId);
for (OWLObjectPropertyAssertionAxiom ax : ont.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION)) {
if (ax.getSubject().equals(i)) {
if (p == null || ax.getProperty().equals(p)) {
if (j == null || ax.getObject().equals(j)) {
removeAxiom(ont, graph.getDataFactory().getOWLObjectPropertyAssertionAxiom(p, i, j));
}
}
}
}
String jsonStr = "";
response.getWriter().write(jsonStr);
}
示例3: testServerGetCoAnnotationSuggestions
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
@Test
public void testServerGetCoAnnotationSuggestions() throws Exception {
g = loadOntology("../OWLTools-Sim/src/test/resources/sim/mp-subset-1.obo");
String file="../OWLTools-Sim/src/test/resources/sim/mgi-gene2mp-subset-1.tbl";
// g = loadOntology("/Users/Nicole/work/MONARCH/phenotype-ontologies/src/ontology/hp.obo");
// String file="/Users/Nicole/work/MONARCH/phenotype-ontologies/data/Homo_sapiens/Hs-disease-to-phenotype-O.txt";
TableToAxiomConverter ttac = new TableToAxiomConverter(g);
ttac.config.axiomType = AxiomType.CLASS_ASSERTION;
ttac.config.isSwitchSubjectObject = true;
ttac.parse(file);
OwlSimFactory owlSimFactory = new FastOwlSimFactory();
OwlSim sos = owlSimFactory.createOwlSim(g.getSourceOntology());
sos.createElementAttributeMapFromOntology();
// sos.populateFullCoannotationMatrix();
LOG.info("Finished populating the big matrix");
HttpUriRequest httppost = createGoodCoAnnotationRequest(1);
runServerCommunication(httppost,sos);
}
示例4: makeHasPhenotypeInstancesDirect
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
protected void makeHasPhenotypeInstancesDirect() {
// x Type has_phenotype some C ==> x Type C
LOG.info("x Type has_phenotype some C ==> x Type C");
OWLObjectProperty hasPhenotype = getOWLObjectPropertyViaOBOSuffix(HAS_PHENOTYPE);
Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
Set<OWLAxiom> newAxioms = new HashSet<OWLAxiom>();
for (OWLClassAssertionAxiom caa : outputOntology.getAxioms(AxiomType.CLASS_ASSERTION)) {
OWLClassExpression ex = caa.getClassExpression();
OWLIndividual i = caa.getIndividual();
if (ex instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)ex;
if (svf.getProperty().equals(hasPhenotype)) {
rmAxioms.add(caa);
newAxioms.add(getOWLDataFactory().getOWLClassAssertionAxiom(svf.getFiller(), i));
}
}
}
LOG.info("making instances direct: +"+newAxioms.size()+ " -"+rmAxioms.size());
addAxiomsToOutput(newAxioms, false);
removeAxiomsFromOutput(rmAxioms, false);
}
示例5: testAutoSimOnGO
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
@Test
public void testAutoSimOnGO() throws Exception, MathException {
ParserWrapper pw = new ParserWrapper();
sourceOntol = pw.parseOBO(getResourceIRIString("go-subset-t1.obo"));
g = new OWLGraphWrapper(sourceOntol);
IRI vpIRI = g.getOWLObjectPropertyByIdentifier("GOTESTREL:0000001").getIRI();
TableToAxiomConverter ttac = new TableToAxiomConverter(g);
ttac.config.axiomType = AxiomType.CLASS_ASSERTION;
ttac.config.property = vpIRI;
ttac.config.isSwitchSubjectObject = true;
ttac.parse("src/test/resources/simplegaf-t1.txt");
OWLPrettyPrinter pp = new OWLPrettyPrinter(g);
AutomaticSimPreProcessor pproc = new AutomaticSimPreProcessor();
try {
pproc.setInputOntology(sourceOntol);
pproc.setOutputOntology(sourceOntol);
pproc.preprocess();
} finally {
pproc.dispose();
}
}
示例6: getPropertyChains
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
public Set<List<OWLObjectPropertyExpression>> getPropertyChains(OWLObjectProperty p) {
LOG.info("Getting chains for: "+p);
Set<List<OWLObjectPropertyExpression>> chains = new HashSet<List<OWLObjectPropertyExpression>>();
for (OWLSubPropertyChainOfAxiom spca : sourceOntology.getAxioms(AxiomType.SUB_PROPERTY_CHAIN_OF)) {
if (spca.getSuperProperty().equals(p)) {
List<OWLObjectPropertyExpression> chain = spca.getPropertyChain();
chains.add(chain);
// note: limited form of cycle checking
if (!chain.contains(p)) {
chains.addAll(expandPropertyChain(chain));
}
}
}
LOG.info(p+" ==> "+chains);
return chains;
}
示例7: addSubAnnotationProperties
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
void addSubAnnotationProperties(Set<OWLAxiom> axioms) {
// add ALL subannotprop axioms
// - this is quite geared towards obo ontologies, where
// we want to preserve obo headers.
// TODO: make this configurable
LOG.info("adding SubAnnotationProperties");
Set<OWLAxiom> sapAxioms = new HashSet<OWLAxiom>();
for (OWLOntology refOnt : this.getReferencedOntologies()) {
for (OWLSubAnnotationPropertyOfAxiom a : refOnt.getAxioms(AxiomType.SUB_ANNOTATION_PROPERTY_OF)) {
sapAxioms.add(a);
Set<OWLAnnotationAssertionAxiom> s = refOnt.getAnnotationAssertionAxioms(a.getSubProperty().getIRI());
if (s != null && !s.isEmpty()) {
for (OWLAnnotationAssertionAxiom owlAnnotationAssertionAxiom : s) {
sapAxioms.add(owlAnnotationAssertionAxiom);
}
}
}
}
axioms.addAll(sapAxioms);
}
示例8: getMappings
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
public Set<Mapping> getMappings() {
Set<Mapping> ms = new HashSet<Mapping>();
OWLAnnotationProperty vap = getVariableAnnotationProperty();
for (OWLSubClassOfAxiom sca : ontology.getAxioms(AxiomType.SUBCLASS_OF, Imports.INCLUDED)) {
Mapping m = new Mapping();
Set<OWLAnnotation> anns = sca.getAnnotations(vap);
for (OWLAnnotation ann : anns) {
IRI v = (IRI) ann.getValue();
m.vars.add(v);
}
if (m.vars.size() > 0) {
m.src = sca.getSubClass();
m.tgt = sca.getSuperClass();
ms.add(m);
LOG.info("MAPPING: "+m);
}
}
return ms;
}
示例9: initNeighborAxioms
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
private Map<OWLClass, Set<OWLSubClassOfAxiom>> initNeighborAxioms() {
Map<OWLClass, Set<OWLSubClassOfAxiom>> result = new HashMap<OWLClass, Set<OWLSubClassOfAxiom>>();
for(OWLOntology ont : getAllOntologies()) {
for(OWLSubClassOfAxiom ax : ont.getAxioms(AxiomType.SUBCLASS_OF)) {
Set<OWLClass> inSignature = ax.getClassesInSignature();
for (OWLClass cls : inSignature) {
Set<OWLSubClassOfAxiom> neighbors = result.get(cls);
if (neighbors == null) {
neighbors = new HashSet<OWLSubClassOfAxiom>();
result.put(cls, neighbors);
}
neighbors.add(ax);
}
}
}
return result;
}
示例10: getAllOWLObjectsByAltId
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
/**
* Find all corresponding {@link OWLObject}s with an OBO-style alternate identifier.
* <p>
* WARNING: This methods scans all object annotations in all ontologies.
* This is an expensive method.
*
* @return map of altId to OWLObject (never null)
*/
public Map<String, OWLObject> getAllOWLObjectsByAltId() {
final Map<String, OWLObject> results = new HashMap<String, OWLObject>();
final OWLAnnotationProperty altIdProperty = getAnnotationProperty(OboFormatTag.TAG_ALT_ID.getTag());
if (altIdProperty == null) {
return Collections.emptyMap();
}
for (OWLOntology o : getAllOntologies()) {
Set<OWLAnnotationAssertionAxiom> aas = o.getAxioms(AxiomType.ANNOTATION_ASSERTION);
for (OWLAnnotationAssertionAxiom aa : aas) {
OWLAnnotationValue v = aa.getValue();
OWLAnnotationProperty property = aa.getProperty();
if (altIdProperty.equals(property) && v instanceof OWLLiteral) {
String altId = ((OWLLiteral)v).getLiteral();
OWLAnnotationSubject subject = aa.getSubject();
if (subject instanceof IRI) {
OWLObject obj = getOWLObject((IRI) subject);
if (obj != null) {
results.put(altId, obj);
}
}
}
}
}
return results;
}
示例11: getPropertyChainMap
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
private Map<OWLObjectProperty,Set<List<OWLObjectProperty>>> getPropertyChainMap() {
if (pcMap == null) {
pcMap = new HashMap<OWLObjectProperty,Set<List<OWLObjectProperty>>>();
for (OWLSubPropertyChainOfAxiom a : sourceOntology.getAxioms(AxiomType.SUB_PROPERTY_CHAIN_OF)) {
//LOG.info("CHAIN:"+a+" // "+a.getPropertyChain().size());
if (a.getPropertyChain().size() == 2) {
OWLObjectPropertyExpression p1 = a.getPropertyChain().get(0);
OWLObjectPropertyExpression p2 = a.getPropertyChain().get(1);
//LOG.info(" xxCHAIN:"+p1+" o "+p2);
if (p1 instanceof OWLObjectProperty && p2 instanceof OWLObjectProperty) {
List<OWLObjectProperty> list = new Vector<OWLObjectProperty>();
list.add((OWLObjectProperty) p2);
list.add((OWLObjectProperty) a.getSuperProperty());
if (!pcMap.containsKey(p1))
pcMap.put((OWLObjectProperty) p1, new HashSet<List<OWLObjectProperty>>());
pcMap.get((OWLObjectProperty) p1).add(list);
//LOG.info(" xxxCHAIN:"+p1+" ... "+list);
}
}
else {
// TODO
}
}
}
return pcMap;
}
示例12: getAnnotationValue
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
public Set<OWLAnnotationAssertionAxiom> getAnnotationValue(
String turambarOntologyAnnotation) {
OWLDataFactory factory = ontology.getOWLOntologyManager()
.getOWLDataFactory();
final OWLAnnotationProperty dcProperty = factory
.getOWLAnnotationProperty(IRI
.create(turambarOntologyAnnotation));
final Set<OWLAxiom> axioms = dcProperty.getReferencingAxioms(
getOntology(), true);
final Set<OWLAnnotationAssertionAxiom> values = new HashSet<OWLAnnotationAssertionAxiom>();
for (OWLAxiom a : axioms) {
if (a.getAxiomType().equals(AxiomType.ANNOTATION_ASSERTION)) {
final OWLAnnotationAssertionAxiom annotationAssertion = (OWLAnnotationAssertionAxiom) a;
values.add(annotationAssertion);
}
}
return values;
}
示例13: extract
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
/**
* Extracts {@link PredicateVariableExtractor} rules.
*
* @param ot ontology
* @return extracted rules
*/
@Override
public List<Rule> extract(OWLOntology ot) {
List<Rule> list = new ArrayList<>();
// list of predicates in ontology
List<String> ps = new ArrayList<>();
ps.add(TOPOBJ);
ps.add(TOPDATA);
OWLEntity e;
String op;
// check all declarations
for (OWLDeclarationAxiom a : ot.getAxioms(AxiomType.DECLARATION)) {
e = a.getEntity();
if (e.isOWLObjectProperty()) {
// if it is a object property declaration, add it to the list
// and also add it as subproperty of owl:topObjectProperty
op = getString(e.asOWLObjectProperty());
ps.add(op);
list.add(new SubPropertyOf(op, TOPOBJ));
} else if (e.isOWLDataProperty()) {
// if it is a data property declaration, add it to the list
// and also add it as subproperty of owl:topDataProperty
op = getString(e.asOWLDataProperty());
ps.add(op);
list.add(new SubPropertyOf(op, TOPDATA));
}
}
list.add(new PredicateVariable(ps));
return list;
}
示例14: addPositiveAxioms
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
public void addPositiveAxioms(Set<? extends OWLAxiom> axioms) {
for (OWLAxiom axiom : axioms) {
if (axiom.isOfType(AxiomType.EQUIVALENT_CLASSES)) {
addEquation((OWLEquivalentClassesAxiom) axiom);
} else if (axiom.isOfType(AxiomType.SUBCLASS_OF)) {
addSubsumption((OWLSubClassOfAxiom) axiom);
} else {
throw new RuntimeException("Unsupported axiom type: " + axiom);
}
}
}
示例15: addNegativeAxioms
import org.semanticweb.owlapi.model.AxiomType; //导入依赖的package包/类
public void addNegativeAxioms(Set<? extends OWLAxiom> axioms) {
for (OWLAxiom axiom : axioms) {
if (axiom.isOfType(AxiomType.EQUIVALENT_CLASSES)) {
addDisequation((OWLEquivalentClassesAxiom) axiom);
} else if (axiom.isOfType(AxiomType.SUBCLASS_OF)) {
addDissubsumption((OWLSubClassOfAxiom) axiom);
} else {
throw new RuntimeException("Unsupported axiom type: " + axiom);
}
}
}