本文整理汇总了Java中org.semanticweb.owlapi.model.OWLClassExpression.isAnonymous方法的典型用法代码示例。如果您正苦于以下问题:Java OWLClassExpression.isAnonymous方法的具体用法?Java OWLClassExpression.isAnonymous怎么用?Java OWLClassExpression.isAnonymous使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.OWLClassExpression
的用法示例。
在下文中一共展示了OWLClassExpression.isAnonymous方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的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 {
}
}
示例2: handleIntersection
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
private void handleIntersection(List<CheckWarning> warnings, Set<OWLOntology> allOntologies,
OWLEquivalentClassesAxiom axiom, OWLObjectIntersectionOf intersection, OWLPrettyPrinter pp)
{
for(OWLClassExpression operand : intersection.getOperandsAsList()) {
OWLClass operandCls = null;
if (!operand.isAnonymous()) {
operandCls = operand.asOWLClass();
}
else if (operand instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom ristriction = (OWLObjectSomeValuesFrom) operand;
OWLClassExpression filler = ristriction.getFiller();
if (!filler.isAnonymous()) {
operandCls = filler.asOWLClass();
}
}
else {
// not translatable to OBO
handleGeneric(warnings, allOntologies, axiom, operand, pp);
}
if (operandCls != null && isDangling(operandCls, allOntologies)) {
final IRI iri = operandCls.getIRI();
String message = "Dangling reference "+iri+" in INTERSECTION_OF axiom: "+pp.render(axiom);
warnings.add(new CheckWarning(getID(), message , isFatal(), iri, OboFormatTag.TAG_INTERSECTION_OF.getTag()));
}
}
}
示例3: findDescendants
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
protected Set<OWLClass> findDescendants(OWLReasoner r, String expr, Integer numExpected) throws TimeOutException, FreshEntitiesException, InconsistentOntologyException, ClassExpressionNotInProfileException, ReasonerInterruptedException, OWLParserException {
System.out.println("Query: "+expr);
OWLClassExpression qc = parseOMN(expr);
Set<OWLClass> clzs = r.getSubClasses(qc, false).getFlattened();
clzs.remove(r.getRootOntology().getOWLOntologyManager().getOWLDataFactory().getOWLNothing());
if (!qc.isAnonymous())
clzs.add((OWLClass) qc);
System.out.println("NumD:"+clzs.size());
for (OWLClass c : clzs) {
System.out.println(" D:"+c);
}
if (numExpected != null) {
assertEquals(numExpected.intValue(), clzs.size());
}
return clzs;
}
示例4: getDisjointClasses
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) {
ensurePrepared();
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(ce.asOWLClass())) {
for (OWLClassExpression op : ax.getClassExpressions()) {
if (!op.isAnonymous()) {
nodeSet.addNode(getEquivalentClasses(op));
}
}
}
}
}
return nodeSet;
}
示例5: handleUnionOf
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
private void handleUnionOf(List<CheckWarning> warnings, Set<OWLOntology> allOntologies,
OWLEquivalentClassesAxiom axiom, OWLObjectUnionOf union, OWLPrettyPrinter pp)
{
List<OWLClassExpression> operands = union.getOperandsAsList();
for(OWLClassExpression operand : operands) {
if (!operand.isAnonymous()) {
OWLClass operandCls = operand.asOWLClass();
if (isDangling(operandCls, allOntologies)) {
final IRI iri = operandCls.getIRI();
String message = "Dangling reference "+iri+" in UNION_OF axiom: "+pp.render(axiom);
warnings.add(new CheckWarning(getID(), message , isFatal(), iri, OboFormatTag.TAG_UNION_OF.getTag()));
}
}
else {
// not translatable to OBO
handleGeneric(warnings, allOntologies, axiom, operand, pp);
}
}
}
示例6: generateAssociations
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
public Set<GeneAnnotation> generateAssociations(OWLNamedIndividual ind, OWLOntology ont) {
Set<GeneAnnotation> assocs = new HashSet<GeneAnnotation>();
String eid = graph.getIdentifier(ind);
for (OWLClassExpression x : OwlHelper.getTypes(ind, ont)) {
GeneAnnotation ga = new GeneAnnotation();
if (x.isAnonymous()) {
// TODO
}
else {
ga.setCls(graph.getIdentifier(x));
}
ga.setBioentity(eid);
assocs.add(ga);
}
return assocs;
}
示例7: getDisjointClasses
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
* Getting all disjoint classes is costly. We get only explicit disjointness.
* We will complete with questions (A intersection B) later if necessary
*/
public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) {
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
}
}
return nodeSet;
/*if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(ce.asOWLClass())) {
for (OWLClassExpression op : ax.getClassExpressions()) {
if (!op.isAnonymous() && !op.equals(ce)) { //Op must be differnt to ce
nodeSet.addNode(getEquivalentClasses(op));
}
}
}
}
} */
}
示例8: getDisjointClasses
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
* Getting all disjoint classes is costly. We get only explicit disjointness.
* We will complete with questions (A intersection B) later if necessary
*/
public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) {
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
}
}
return nodeSet;
/*if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(ce.asOWLClass())) {
for (OWLClassExpression op : ax.getClassExpressions()) {
if (!op.isAnonymous() && !op.equals(ce)) { //Op must be differnt to ce
nodeSet.addNode(getEquivalentClasses(op));
}
}
}
}
}*/
}
示例9: updateRedundant
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
* Update the set of redundant axioms for the given {@link OWLClass} cls.
*
* @param cls
* @param ontology
* @param redundantAxioms
* @param reasoner
* @param dataFactory
*/
protected static void updateRedundant(OWLClass cls, OWLOntology ontology, Set<OWLAxiom> redundantAxioms,
OWLReasoner reasoner, OWLDataFactory dataFactory)
{
final OWLClass owlThing = dataFactory.getOWLThing();
// get all direct super classes
final Set<OWLClass> direct = reasoner.getSuperClasses(cls, true).getFlattened();
direct.remove(owlThing);
// get all super classes (includes direct ones)
final Set<OWLClass> indirect = reasoner.getSuperClasses(cls, false).getFlattened();
indirect.remove(owlThing);
// remove direct super classes from all -> redundant super classes
indirect.removeAll(direct);
// rename
final Set<OWLClass> redundant = indirect;
// filter
// subclass of axioms, which have a super class in the redundant set
Set<OWLSubClassOfAxiom> axioms = ontology.getSubClassAxiomsForSubClass(cls);
for (OWLSubClassOfAxiom subClassOfAxiom : axioms) {
OWLClassExpression ce = subClassOfAxiom.getSuperClass();
if (!ce.isAnonymous()) {
OWLClass superClass = ce.asOWLClass();
if (redundant.contains(superClass)) {
redundantAxioms.add(subClassOfAxiom);
}
}
}
}
示例10: classifyRelationship
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
/**
* Classify the an edge and target as a human readable string for further processing.
*
* @param owlGraphEdge edge under consideration
* @param edgeDirector
* @param props properties set
* @return null, "simplesubclass", "typesubclass", or "identity".
* @see #addDirectDescendentsToShuntGraph
* @see #addStepwiseAncestorsToShuntGraph
*/
public String classifyRelationship(OWLGraphEdge owlGraphEdge, OWLObject edgeDirector, Set<? extends OWLPropertyExpression> props){
String retval = null;
OWLQuantifiedProperty qp = owlGraphEdge.getSingleQuantifiedProperty();
if( qp.isSubClassOf() || props.contains(qp.getProperty()) ){
//OWLObject target = owlGraphEdge.getTarget();
if( edgeDirector instanceof OWLClass ){
retval = "simplesubclass";
}else if( edgeDirector instanceof OWLObjectSomeValuesFrom ){
OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom)edgeDirector;
if( props.contains(some.getProperty()) ){
OWLClassExpression clsexp = some.getFiller();
if( ! clsexp.isAnonymous()){
retval = "typesubclass";
}
}
}
}else if( qp.isIdentity() ){
retval = "identity";
}else{
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping complex edge: "+owlGraphEdge);
}
}
return retval;
}
示例11: getSuperClasses
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce,
boolean direct) throws InconsistentOntologyException,
ClassExpressionNotInProfileException, FreshEntitiesException,
ReasonerInterruptedException, TimeOutException {
if (ce.isAnonymous()) {
OWLClass c = materializeExpression(ce);
return getSuperClasses(c, direct);
}
return getWrappedReasoner().getSuperClasses(ce, direct);
}
示例12: getSubClasses
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
public NodeSet<OWLClass> getSubClasses(OWLClassExpression ce, boolean direct)
throws ReasonerInterruptedException, TimeOutException,
FreshEntitiesException, InconsistentOntologyException,
ClassExpressionNotInProfileException {
if (ce.isAnonymous()) {
OWLClass c = materializeExpression(ce);
return getSubClasses(c, direct);
}
return getWrappedReasoner().getSubClasses(ce, direct);
}
示例13: getEquivalentClasses
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
public Node<OWLClass> getEquivalentClasses(OWLClassExpression ce)
throws InconsistentOntologyException,
ClassExpressionNotInProfileException, FreshEntitiesException,
ReasonerInterruptedException, TimeOutException {
if (ce.isAnonymous()) {
OWLClass c = materializeExpression(ce);
return getEquivalentClasses(c);
}
return getWrappedReasoner().getEquivalentClasses(ce);
}
示例14: getInstances
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce,
boolean direct) throws InconsistentOntologyException,
ClassExpressionNotInProfileException, FreshEntitiesException,
ReasonerInterruptedException, TimeOutException {
if (ce.isAnonymous()) {
OWLClass c = materializeExpression(ce);
return getInstances(c, direct);
}
return getWrappedReasoner().getInstances(ce, direct);
}
示例15: addLabel
import org.semanticweb.owlapi.model.OWLClassExpression; //导入方法依赖的package包/类
public static void addLabel(OWLNamedIndividual i, OWLGraphWrapper g, OWLReasoner reasoner) {
OWLOntology ontology = g.getSourceOntology();
Set<OWLClass> types = new HashSet<>();
if (reasoner == null) {
for (OWLClassExpression x : OwlHelper.getTypes(i, ontology)) {
if (!x.isAnonymous()) {
types.add((OWLClass) x);
}
}
}
else {
types = reasoner.getTypes(i, true).getFlattened();
}
StringBuffer iLabel = null;
for (OWLClass type : types) {
String label = g.getLabel(type);
if (iLabel == null)
iLabel = new StringBuffer("a");
else
iLabel.append(" & ");
iLabel.append(" "+label);
}
OWLDataFactory df = g.getDataFactory();
OWLAxiom ax =
df.getOWLAnnotationAssertionAxiom(df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
i.getIRI(),
df.getOWLLiteral(iLabel.toString()));
g.getManager().addAxiom(ontology,
ax);
}