本文整理汇总了Java中org.semanticweb.owlapi.model.OWLClassAssertionAxiom.getIndividual方法的典型用法代码示例。如果您正苦于以下问题:Java OWLClassAssertionAxiom.getIndividual方法的具体用法?Java OWLClassAssertionAxiom.getIndividual怎么用?Java OWLClassAssertionAxiom.getIndividual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.OWLClassAssertionAxiom
的用法示例。
在下文中一共展示了OWLClassAssertionAxiom.getIndividual方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public void visit(OWLClassAssertionAxiom axiom) {
if (axiom.getClassExpression().isOWLThing())
return;
OWLIndividual node=axiom.getIndividual();
if (!node.isAnonymous()) {
namedNodes.add(node.asOWLNamedIndividual());
}
else {
nodes.add(node.asOWLAnonymousIndividual());
if (nodelLabels.containsKey(node)) {
nodelLabels.get(node).add(axiom.getClassExpression());
}
else {
Set<OWLClassExpression> label=new HashSet<OWLClassExpression>();
label.add(axiom.getClassExpression());
nodelLabels.put(node.asOWLAnonymousIndividual(),label);
}
}
}
示例2: makeHasPhenotypeInstancesDirect
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的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);
}
示例3: visit
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public void visit(OWLClassAssertionAxiom classAssertion) {
OWLIndividual individual = classAssertion.getIndividual();
OWLClassExpression classExpression = classAssertion.getClassExpression();
if (!classExpression.isAnonymous()) {
OWLClass namedClass = classExpression.asOWLClass();
writer.print(namedClass.getIRI().getFragment());
writer.print("(");
writer.print(IRI.create(individual.toStringID()).getFragment());
writer.print(").\n");
}
else {
}
}
示例4: getInstances
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
ensurePrepared();
DefaultNodeSet<OWLNamedIndividual> result = new OWLNamedIndividualNodeSet();
if (!ce.isAnonymous()) {
OWLClass cls = ce.asOWLClass();
Set<OWLClass> clses = new HashSet<OWLClass>();
clses.add(cls);
if (!direct) {
clses.addAll(getSubClasses(cls, false).getFlattened());
}
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLClass curCls : clses) {
for (OWLClassAssertionAxiom axiom : ontology.getClassAssertionAxioms(curCls)) {
OWLIndividual individual = axiom.getIndividual();
if (!individual.isAnonymous()) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(individual.asOWLNamedIndividual()));
}
else {
result.addNode(new OWLNamedIndividualNode(individual.asOWLNamedIndividual()));
}
}
}
}
}
}
return result;
}
示例5: generateClassName
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public static Map<ATermAppl, Set<ConditionalConstraint>>
loadConcreteConstraintsFromOWL( OWLOntology ontology,
Map<String, OWLClassExpression> nameMap,
Set<OWLEntity> signature,
List<RemoveAxiom> raxList,
String iriPrefix,
OWLOntologyManager manager) {
Map<ATermAppl, Set<ConditionalConstraint>> ccMap = new HashMap<ATermAppl, Set<ConditionalConstraint>>();
ConditionalConstraint cc = null;
Set<ConditionalConstraint> ccSet = null;
OWLDataFactory factory = manager.getOWLDataFactory();
for( OWLAxiom axiom : ontology.getAxioms( AxiomType.CLASS_ASSERTION ) ) {
for( OWLAnnotation annotation : axiom.getAnnotations() ) {
if( Constants.CERTAINTY_ANNOTATION_URI.equals( annotation.getProperty().getIRI().toURI() ) ) {
OWLClassAssertionAxiom caAxiom = (OWLClassAssertionAxiom) axiom;
String classNameIRI = generateClassName(caAxiom.getClassExpression(), nameMap, iriPrefix);
OWLIndividual individ = caAxiom.getIndividual();
ATermAppl indTerm = ATermUtils.makeTermAppl( individ.asOWLNamedIndividual().getIRI().toURI().toString() );
ccSet = (Set<ConditionalConstraint>) ccMap.get( indTerm );
cc = newConstraint( factory.getOWLThing().getIRI().toString(), classNameIRI, annotation.getValue().toString() );
signature.addAll( caAxiom.getClassExpression().getClassesInSignature() );
if( null != cc ) {
if( null == ccSet ) {
ccSet = new HashSet<ConditionalConstraint>();
}
ccSet.add( cc );
ccMap.put( indTerm, ccSet );
if( null != raxList ) {
raxList.add( new RemoveAxiom( ontology, axiom ) );
}
}
}
}
}
return ccMap;
}
示例6: mapClassAssertionsUp
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入方法依赖的package包/类
public static void mapClassAssertionsUp(OWLOntology ont, OWLReasoner reasoner, Set<OWLClass> targetClasses, Set<OWLClass> inputClasses) {
Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
Set<OWLAxiom> newAxioms = new HashSet<OWLAxiom>();
Map<OWLClass, Set<OWLClass>> cmap = new HashMap<OWLClass, Set<OWLClass>>();
LOG.info("Target classes: "+targetClasses.size());
int n=0;
for (OWLClassAssertionAxiom ca : ont.getAxioms(AxiomType.CLASS_ASSERTION)) {
if (ca.getClassExpression().isAnonymous())
continue;
OWLClass c = (OWLClass) ca.getClassExpression();
n++;
if (inputClasses == null || inputClasses.contains(c)) {
if (targetClasses.contains(c))
continue;
Set<OWLClass> supers;
if (cmap.containsKey(c)) {
supers = cmap.get(c);
}
else {
supers = reasoner.getSuperClasses(c, false).getFlattened();
supers.addAll(reasoner.getEquivalentClasses(c).getEntities());
LOG.info(c+" has #supers: "+supers.size());
LOG.info(c + " ===> "+supers);
supers.retainAll(targetClasses);
LOG.info(c+" has #supersInTargetSet: "+supers.size());
supers = getNonRedundant(supers, reasoner);
//LOG.info(c+" has #NRsupers: "+supers.size());
//LOG.info(c + " ===> "+supers);
cmap.put(c, supers);
if (supers.size() > 0) {
LOG.info(c + " ===> "+supers);
}
}
rmAxioms.add(ca);
OWLIndividual individual = ca.getIndividual();
for (OWLClass sc : supers) {
newAxioms.add(ont.getOWLOntologyManager().getOWLDataFactory().getOWLClassAssertionAxiom(sc, individual));
}
}
}
LOG.info("named class assertions (start): "+n);
LOG.info("rm:"+rmAxioms.size());
LOG.info("new:"+newAxioms.size());
ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
ont.getOWLOntologyManager().addAxioms(ont, newAxioms);
}