本文整理汇总了Java中org.semanticweb.owlapi.model.OWLAnonymousIndividual类的典型用法代码示例。如果您正苦于以下问题:Java OWLAnonymousIndividual类的具体用法?Java OWLAnonymousIndividual怎么用?Java OWLAnonymousIndividual使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OWLAnonymousIndividual类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLAnonymousIndividual类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueAsString
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
public String getValueAsString() {
if (value instanceof IRI) {
return value.toString();
}
else if (value instanceof OWLLiteral) {
return ((OWLLiteral) value).getLiteral();
}
else if (value instanceof OWLAnonymousIndividual) {
return ((OWLAnonymousIndividual) value).getID().toString();
}
else if (value instanceof Var) {
return ((Var) value).getName();
}
else {
return value.toString();
}
}
示例2: getStringValue
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
private String getStringValue(OWLAnnotationAssertionAxiom ax) {
OWLAnnotationValue value = ax.getValue();
String stringValue = value.accept(new OWLAnnotationValueVisitorEx<String>() {
@Override
public String visit(IRI iri) {
return iri.toString();
}
@Override
public String visit(OWLAnonymousIndividual individual) {
return null;
}
@Override
public String visit(OWLLiteral literal) {
return literal.getLiteral();
}
});
return stringValue;
}
示例3: create
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
private static JsonAnnotation create(final String key, OWLAnnotationValue value, final CurieHandler curieHandler) {
return value.accept(new OWLAnnotationValueVisitorEx<JsonAnnotation>() {
@Override
public JsonAnnotation visit(IRI iri) {
String iriString = curieHandler.getCuri(iri);
return JsonAnnotation.create(key, iriString, VALUE_TYPE_IRI);
}
@Override
public JsonAnnotation visit(OWLAnonymousIndividual individual) {
return null; // do nothing
}
@Override
public JsonAnnotation visit(OWLLiteral literal) {
return JsonAnnotation.create(key, literal.getLiteral(), getType(literal));
}
});
}
示例4: extractEvidenceIRIValues
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
private static void extractEvidenceIRIValues(OWLAnnotation annotation, final Set<IRI> iriSet) {
if (annotation != null) {
OWLAnnotationProperty property = annotation.getProperty();
if (HAS_EVIDENCE_IRI.equals(property.getIRI()) || HAS_EVIDENCE_IRI_OLD.equals(property.getIRI())){
annotation.getValue().accept(new OWLAnnotationValueVisitor() {
@Override
public void visit(OWLLiteral literal) {
// ignore
}
@Override
public void visit(OWLAnonymousIndividual individual) {
// ignore
}
@Override
public void visit(IRI iri) {
iriSet.add(iri);
}
});
}
}
}
示例5: asAnonymousIndividual
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
/**
* As in Mouse and NCI anatomy. Annotations al rdf:labels in anonymous individuals
* It seems also GO ontology (to be checked)
* @param entityAnnAx
* @return
*/
private String asAnonymousIndividual(OWLAnnotationAssertionAxiom entityAnnAx, OWLOntology onto){
try {
geneid_value=((OWLAnonymousIndividual)entityAnnAx.getAnnotation().getValue()).asOWLAnonymousIndividual();//.getID()
for (OWLAnnotationAssertionAxiom annGeneidAx : onto.getAnnotationAssertionAxioms(geneid_value)){
if (annGeneidAx.getAnnotation().getProperty().getIRI().toString().equals(rdf_label_uri)){
return ((OWLLiteral)annGeneidAx.getAnnotation().getValue()).getLiteral().toLowerCase();
}
}
return "";
}
catch (Exception e){
//In case of error. Accessing an object in an expected way
return "";
}
}
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:24,代码来源:ExtractStringFromAnnotationAssertionAxiom.java
示例6: visit
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
public void visit(OWLDataPropertyAssertionAxiom axiom) {
if (!axiom.getSubject().isAnonymous()) {
return; // not interesting for the anonymous individual forest
}
OWLAnonymousIndividual sub=axiom.getSubject().asOWLAnonymousIndividual();
nodes.add(sub);
OWLClassExpression c=factory.getOWLDataHasValue(axiom.getProperty(),axiom.getObject());
if (nodelLabels.containsKey(sub)) {
nodelLabels.get(sub).add(c);
}
else {
Set<OWLClassExpression> labels=new HashSet<OWLClassExpression>();
labels.add(c);
nodelLabels.put(sub,labels);
}
}
示例7: findEvidenceIndividual
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
private OWLNamedIndividual findEvidenceIndividual(OWLAnnotationValue value) {
return value.accept(new OWLAnnotationValueVisitorEx<OWLNamedIndividual>() {
@Override
public OWLNamedIndividual visit(final IRI iri) {
OWLNamedIndividual i = null;
for(OWLNamedIndividual current : model.getIndividualsInSignature()) {
if (current.getIRI().equals(iri)) {
i = current;
break;
}
}
return i;
}
@Override
public OWLNamedIndividual visit(OWLAnonymousIndividual individual) {
return null;
}
@Override
public OWLNamedIndividual visit(OWLLiteral literal) {
return null;
}
});
}
示例8: getLabel
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
public static String getLabel(OWLEntity e, OWLOntology ont) {
final Iterator<OWLAnnotation> iterator = EntitySearcher.getAnnotations(e, ont).iterator();
while (iterator.hasNext()) {
final OWLAnnotation an = iterator.next();
if (an.getProperty().isLabel()) {
OWLAnnotationValue val = an.getValue();
if (val instanceof IRI) {
return ((IRI) val).toString();
} else if (val instanceof OWLLiteral) {
OWLLiteral lit = (OWLLiteral) val;
return lit.getLiteral();
} else if (val instanceof OWLAnonymousIndividual) {
OWLAnonymousIndividual ind = (OWLAnonymousIndividual) val;
return ind.toStringID();
} else {
throw new RuntimeException("Unexpected class "
+ val.getClass());
}
}
}
return e.toStringID();
}
示例9: getLabel
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
public static String getLabel(OWLEntity e, OWLOntology ont) {
return EntitySearcher.getAnnotations(e, ont)
.filter(an -> an.getProperty().isLabel())
.findFirst()
.map(an -> {
final OWLAnnotationValue val = an.getValue();
if (val instanceof IRI) {
return ((IRI) val).toString();
} else if (val instanceof OWLLiteral) {
OWLLiteral lit = (OWLLiteral) val;
return lit.getLiteral();
} else if (val instanceof OWLAnonymousIndividual) {
OWLAnonymousIndividual ind = (OWLAnonymousIndividual) val;
return ind.toStringID();
} else {
throw new RuntimeException("Unexpected class "
+ val.getClass());
}
})
.orElse(e.toStringID());
}
示例10: addToOntology
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
@Override
public void addToOntology() {
OWLClass clazz = featurePool.getReusableClass();
OWLAnonymousIndividual individual = factory.getOWLAnonymousIndividual();
addAxiomToOntology(factory.getOWLClassAssertionAxiom(clazz, individual));
}
示例11: testIsBnode
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
@Test
public void testIsBnode()
{
QueryArgument arg = new QueryArgument(mock(OWLAnonymousIndividual.class));
assertTrue(arg.isBnode());
QueryArgument arg2 = new QueryArgument(new Var("x"));
assertFalse(arg2.isBnode());
}
示例12: getModelState
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
public static String getModelState(OWLOntology model, String defaultValue) {
String modelState = defaultValue;
Set<OWLAnnotation> modelAnnotations = model.getAnnotations();
for (OWLAnnotation modelAnnotation : modelAnnotations) {
IRI propIRI = modelAnnotation.getProperty().getIRI();
if (AnnotationShorthand.modelstate.getAnnotationProperty().equals(propIRI)) {
String value = modelAnnotation.getValue().accept(new OWLAnnotationValueVisitorEx<String>() {
@Override
public String visit(IRI iri) {
return null;
}
@Override
public String visit(OWLAnonymousIndividual individual) {
return null;
}
@Override
public String visit(OWLLiteral literal) {
return literal.getLiteral();
}
});
if (value != null) {
modelState = value;
}
}
}
return modelState;
}
示例13: isTagged
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
static boolean isTagged(Set<OWLAnnotation> annotations, OWLAnnotationProperty p) {
if (annotations != null && !annotations.isEmpty()) {
for (OWLAnnotation annotation : annotations) {
if (p.equals(annotation.getProperty())) {
String value = annotation.getValue().accept(new OWLAnnotationValueVisitorEx<String>() {
@Override
public String visit(IRI iri) {
return null;
}
@Override
public String visit(OWLAnonymousIndividual individual) {
return null;
}
@Override
public String visit(OWLLiteral literal) {
return literal.getLiteral();
}
});
if (value != null && ModelWriterHelper.DERIVED_VALUE.equalsIgnoreCase(value)) {
return true;
}
}
}
}
return false;
}
示例14: getClassExpressionFor
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
protected OWLClassExpression getClassExpressionFor(OWLDataFactory factory,OWLAnonymousIndividual node,OWLAnonymousIndividual predecessor) {
Set<OWLAnonymousIndividual> successors=edges.get(node);
if (successors==null||(successors.size()==1&&successors.iterator().next()==predecessor)) {
// the tree consists of a single node
if (!nodelLabels.containsKey(node)) {
return factory.getOWLThing();
}
else if (nodelLabels.get(node).size()==1) {
return nodelLabels.get(node).iterator().next();
}
else {
return factory.getOWLObjectIntersectionOf(nodelLabels.get(node));
}
}
Set<OWLClassExpression> concepts=new HashSet<OWLClassExpression>();
for (OWLAnonymousIndividual successor : successors) {
OWLObjectProperty op;
Edge pair=new Edge(node,successor);
if (edgeOPLabels.containsKey(pair)) {
op=edgeOPLabels.get(pair);
}
else {
pair=new Edge(successor,node);
if (!edgeOPLabels.containsKey(pair)) {
throw new RuntimeException("Internal error: some edge in the forest of anonymous individuals has no edge label although it should. ");
}
else {
op=edgeOPLabels.get(pair);
}
}
concepts.add(factory.getOWLObjectSomeValuesFrom(op,getClassExpressionFor(factory,successor,node)));
}
return concepts.size()==1 ? concepts.iterator().next() : factory.getOWLObjectIntersectionOf(concepts);
}
示例15: findSuitableRoots
import org.semanticweb.owlapi.model.OWLAnonymousIndividual; //导入依赖的package包/类
protected Map<Set<OWLAnonymousIndividual>,OWLAnonymousIndividual> findSuitableRoots(Set<Set<OWLAnonymousIndividual>> components) {
Map<Set<OWLAnonymousIndividual>,OWLAnonymousIndividual> componentsToRoots=new HashMap<Set<OWLAnonymousIndividual>,OWLAnonymousIndividual>();
for (Set<OWLAnonymousIndividual> component : components) {
// We have to find a node with at most one relation to the named individuals
// if there is one with exactly one relation that is a bit nicer for the rolling-up
// so we try to find that
OWLAnonymousIndividual root=null;
OWLAnonymousIndividual rootWithOneNamedRelation=null;
for (OWLAnonymousIndividual ind : component) {
if (specialOPEdges.containsKey(ind)) {
if (specialOPEdges.get(ind).size()<2) {
rootWithOneNamedRelation=ind;
}
}
else {
root=ind;
}
}
if (root==null&&rootWithOneNamedRelation==null) {
throw new IllegalArgumentException("Invalid input ontology: One of the trees in the forst of anomnymous individuals has no root that satisfies the criteria on roots (cf. OWL 2 Structural Specification and Functional-Style Syntax, Sec. 11.2).");
}
else if (rootWithOneNamedRelation!=null) {
componentsToRoots.put(component,rootWithOneNamedRelation);
}
else {
componentsToRoots.put(component,root);
}
}
return componentsToRoots;
}