Java 类org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom 实例源码

项目:minerva    文件:LegoModelWalker.java   
private Set<OWLObjectSomeValuesFrom> getExpressions(OWLNamedIndividual i, OWLOntology model) {
    Set<OWLObjectSomeValuesFrom> result = new HashSet<OWLObjectSomeValuesFrom>();
    Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(i);
    for (OWLObjectPropertyAssertionAxiom ax : axioms) {
        if (enabledBy.equals(ax.getProperty())) {
            continue;
        }
        OWLIndividual object = ax.getObject();
        if (object.isNamed()) {
            Set<OWLClass> types = getTypes(object.asOWLNamedIndividual(), model);
            for (OWLClass cls : types) {
                result.add(createSvf(ax.getProperty(), cls));
            }
        }
    }
    return result;
}
项目:minerva    文件:MolecularModelJsonRenderer.java   
/**
 * @param opa
 * @return Map to be passed to Gson
 */
public JsonOwlFact renderObject(OWLObjectPropertyAssertionAxiom opa) {
    OWLNamedIndividual subject;
    OWLObjectProperty property;
    OWLNamedIndividual object;

    JsonOwlFact fact = null;
    if (opa.getSubject().isNamed() && opa.getObject().isNamed() && opa.getProperty().isAnonymous() == false) {
        subject = opa.getSubject().asOWLNamedIndividual();
        property = opa.getProperty().asOWLObjectProperty();
        object = opa.getObject().asOWLNamedIndividual();

        fact = new JsonOwlFact();
        fact.subject = curieHandler.getCuri(subject);
        fact.property = curieHandler.getCuri(property);
        fact.propertyLabel = graph.getLabel(property);
        fact.object = curieHandler.getCuri(object);

        JsonAnnotation[] anObjs = renderAnnotations(opa.getAnnotations(), curieHandler);
        if (anObjs != null && anObjs.length > 0) {
            fact.annotations = anObjs;
        }
    }
    return fact;
}
项目:minerva    文件:CoreMolecularModelManager.java   
public Set<IRI> removeFact(ModelContainer model, OWLObjectPropertyExpression p,
        OWLIndividual i, OWLIndividual j, METADATA metadata) {
    OWLDataFactory f = model.getOWLDataFactory();

    OWLOntology ont = model.getAboxOntology();
    OWLAxiom toRemove = null;
    Set<IRI> iriSet = new HashSet<IRI>();
    Set<OWLObjectPropertyAssertionAxiom> candidates = ont.getObjectPropertyAssertionAxioms(i);
    for (OWLObjectPropertyAssertionAxiom axiom : candidates) {
        if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
            toRemove = axiom;
            extractEvidenceIRIValues(axiom.getAnnotations(), iriSet);
            break;
        }
    }
    if (toRemove == null) {
        // fall back solution
        toRemove = f.getOWLObjectPropertyAssertionAxiom(p, i, j);
    }
    removeAxiom(model, toRemove, metadata);
    return iriSet;
}
项目:minerva    文件:CoreMolecularModelManager.java   
OWLObjectPropertyAssertionAxiom updateAnnotation(ModelContainer model, 
        OWLObjectPropertyAssertionAxiom toModify, OWLAnnotation update,
        METADATA metadata) {
    OWLObjectPropertyAssertionAxiom newAxiom = null;
    if (toModify != null) {
        Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>();
        OWLAnnotationProperty target = update.getProperty();
        for(OWLAnnotation existing : toModify.getAnnotations()) {
            if (target.equals(existing.getProperty()) == false) {
                combindedAnnotations.add(existing);
            }
        }
        combindedAnnotations.add(update);
        newAxiom = modifyAnnotations(toModify, combindedAnnotations, model, metadata);
    }
    return newAxiom;
}
项目:minerva    文件:CoreMolecularModelManager.java   
public OWLObjectPropertyAssertionAxiom removeAnnotations(ModelContainer model, OWLObjectPropertyExpression p,
        OWLNamedIndividual i, OWLNamedIndividual j, Set<OWLAnnotation> annotations, METADATA metadata) {
    OWLOntology ont = model.getAboxOntology();
    Set<OWLObjectPropertyAssertionAxiom> axioms = ont.getObjectPropertyAssertionAxioms(i);
    OWLObjectPropertyAssertionAxiom toModify = null;
    for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
        if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
            toModify = axiom;
            break;
        }
    }
    OWLObjectPropertyAssertionAxiom newAxiom = null;
    if (toModify != null) {
        Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>(toModify.getAnnotations());
        combindedAnnotations.removeAll(annotations);
        newAxiom = modifyAnnotations(toModify, combindedAnnotations, model, metadata);
    }
    return newAxiom;
}
项目:owltools    文件:OWLHandler.java   
@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);
}
项目:owltools    文件:ModelAnnotationSolrDocumentLoader.java   
private Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> findProcesses(OWLNamedIndividual mf) {
    Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> result = new HashMap<OWLClass, Pair<OWLNamedIndividual,Set<OWLAnnotation>>>();
    Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(mf);
    for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
        if (partOf.equals(axiom.getProperty()) && mf.equals(axiom.getSubject())) {
            // relevant axiom
            OWLIndividual bpCandidate = axiom.getObject();
            if (bpCandidate.isNamed()) {
                final OWLNamedIndividual named = bpCandidate.asOWLNamedIndividual();
                Set<OWLClass> bpTypes = getTypes(named);
                for (OWLClass bpType : bpTypes) {
                    if (bpSet.contains(bpType) == false) {
                        continue;
                    }
                    result.put(bpType, Pair.of(named, getAnnotations(axiom, named)));
                }
            }
        }
    }
    return result;
}
项目:owltools    文件:ModelAnnotationSolrDocumentLoader.java   
private Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> findLocations(OWLNamedIndividual mf) {
    Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> result = new HashMap<OWLClass, Pair<OWLNamedIndividual,Set<OWLAnnotation>>>();
    Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(mf);
    for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
        if (occursIn.equals(axiom.getProperty()) && mf.equals(axiom.getSubject())) {
            // relevant axiom
            OWLIndividual locationCandidate = axiom.getObject();
            if (locationCandidate.isNamed()) {
                OWLNamedIndividual named = locationCandidate.asOWLNamedIndividual();
                Set<OWLClass> locationTypes = getTypes(named);
                for (OWLClass locationType : locationTypes) {
                    result.put(locationType, Pair.of(named, getAnnotations(axiom, named)));
                }
            }
        }
    }
    return result;
}
项目:owltools    文件:OWLInAboxTranslator.java   
/**
 * @param i - source
 * @param supc - target expression (e.g. R some B)
 * @return OWLObjectPropertyAssertionAxiom or null
 */
private OWLObjectPropertyAssertionAxiom trEdge(OWLIndividual i, OWLClassExpression supc) {
    if (supc instanceof OWLObjectSomeValuesFrom) {
        OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)supc;
        OWLObjectPropertyExpression p = trTypeLevel(svf.getProperty());
        OWLIndividual j;
        if (svf.getFiller().isAnonymous()) {
            j = anonClassToIndividual(svf.getFiller());
            add(trEdge(j, svf.getFiller()));
        }
        else {
            j = classToIndividual((OWLClass)svf.getFiller());
        }

        OWLObjectPropertyAssertionAxiom e = getOWLDataFactory().getOWLObjectPropertyAssertionAxiom(p, i, j); 
        return e;
    }
    return null;

}
项目:Wolpertinger    文件:DebugTranslation.java   
public void visit(OWLObjectPropertyAssertionAxiom objPropertyAssertion) {
    OWLObjectProperty property = objPropertyAssertion.getProperty().asOWLObjectProperty();
    OWLNamedIndividual subject = objPropertyAssertion.getSubject().asOWLNamedIndividual();
    OWLNamedIndividual object = objPropertyAssertion.getObject().asOWLNamedIndividual();

    String propertyName = mapper.getPredicateName(property);
    String subjectName = mapper.getConstantName(subject);
    String objectName = mapper.getConstantName(object);

    writer.print(propertyName);
    writer.print(ASP2CoreSymbols.BRACKET_OPEN);
    writer.print(subjectName);
    writer.print(ASP2CoreSymbols.ARG_SEPERATOR);
    writer.print(objectName);
    writer.print(ASP2CoreSymbols.BRACKET_CLOSE);
    writer.print(ASP2CoreSymbols.EOR);
}
项目:Wolpertinger    文件:NaiveTranslation.java   
public void visit(OWLObjectPropertyAssertionAxiom objPropertyAssertion) {
    OWLObjectProperty property = objPropertyAssertion.getProperty().asOWLObjectProperty();
    OWLNamedIndividual subject = objPropertyAssertion.getSubject().asOWLNamedIndividual();
    OWLNamedIndividual object = objPropertyAssertion.getObject().asOWLNamedIndividual();

    String propertyName = mapper.getPredicateName(property);
    String subjectName = mapper.getConstantName(subject);
    String objectName = mapper.getConstantName(object);

    writer.print(propertyName);
    writer.print(ASP2CoreSymbols.BRACKET_OPEN);
    writer.print(subjectName);
    writer.print(ASP2CoreSymbols.ARG_SEPERATOR);
    writer.print(objectName);
    writer.print(ASP2CoreSymbols.BRACKET_CLOSE);
    writer.print(ASP2CoreSymbols.EOR);
}
项目:ppinot    文件:GeneratePpinotAxioms.java   
/**
 * Genera los axiomas correspondientes a un PPI
 * 
 * @param element Objeto del modelo del PPI
 * @param bpmn20ModelHandler Manejador del modelo BPMN correspondiente al mismo proceso del PPI
 * @return Objeto OWL de la medida
 * @throws Exception
 */
void converterPpiOWL(PPI element, Bpmn20ModelHandlerInterface bpmn20ModelHandler) throws Exception {

    String ppiId = element.getId();

    MeasureDefinition measuredBy = element.getMeasuredBy();
    String measureId = measuredBy.getId();

    // adiciona el axioma que indica la clase del PPI
    OWLNamedIndividual ppiIndividual = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+ppiId) );
    OWLClass ppiClass = factory.getOWLClass( IRI.create(Vocabulary.PPI_URI));
    OWLClassAssertionAxiom ppiClassAxiom = factory.getOWLClassAssertionAxiom(ppiClass, ppiIndividual);
    manager.addAxiom(ontology, ppiClassAxiom);

    // adiciona el axioma con la relacion entre el PPI y la medida
    OWLObjectPropertyExpression definition = factory.getOWLObjectProperty(IRI.create(Vocabulary.DEFINITION_URI));
    OWLNamedIndividual measureIndividual = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+measureId) );
    OWLObjectPropertyAssertionAxiom definitionAxiom = factory.getOWLObjectPropertyAssertionAxiom(definition, ppiIndividual, measureIndividual);
    manager.addAxiom(ontology, definitionAxiom);
}
项目:owlbuilder    文件:Participant.java   
private OWLObject generateDependentOWLIndividual(Owlbuilder builder,
        PropertyTerm childProperty,
        OWLIndividual headInd,
        OWLObject childObject,
        Map<String,OWLObject> names) throws Exception{
    final OWLDataFactory factory = builder.getDataFactory();
    OWLObjectProperty elementProperty = (OWLObjectProperty)childProperty.generateOWL(builder,names);
    log.info("Generated Individual reference: " + headInd);
    if (childObject != null){
        if (childObject instanceof OWLIndividual){
            OWLIndividual childIndividual = (OWLIndividual)childObject;
            OWLObjectPropertyAssertionAxiom assertion =
                    factory.getOWLObjectPropertyAssertionAxiom(elementProperty, headInd, childIndividual);
            // Finally, add the axiom to our ontology and save
            AddAxiom addAxiomChange = new AddAxiom(builder.getTarget(), assertion);
            builder.getOntologyManager().applyChange(addAxiomChange);
        }
        else {  //child is class expression?
            log.info("class child of individual");
        }

    }
    return headInd; //TODO finish implementing individual case
}
项目:minerva    文件:OperationsImpl.java   
private void updateAnnotationsForDelete(DeleteInformation info, ModelContainer model, String userId, Set<String> providerGroups, UndoMetadata token, UndoAwareMolecularModelManager m3) throws UnknownIdentifierException {
    final OWLDataFactory f = model.getOWLDataFactory();
    final OWLAnnotation annotation = createDateAnnotation(f);
    final Set<OWLAnnotation> generated = new HashSet<OWLAnnotation>();
    addGeneratedAnnotations(userId, providerGroups, generated, f);
    for(IRI subject : info.touched) {
        m3.updateAnnotation(model, subject, annotation, token);
        m3.addAnnotations(model, subject, generated, token);
    }
    if (info.updated.isEmpty() == false) {
        Set<OWLObjectPropertyAssertionAxiom> newAxioms = 
                m3.updateAnnotation(model, info.updated, annotation, token);
        m3.addAnnotations(model, newAxioms, generated, token);
    }
}
项目:minerva    文件:MolecularModelJsonRenderer.java   
/**
 * @return Map to be passed to Gson
 */
public JsonModel renderModel() {
    JsonModel json = new JsonModel();
    json.modelId = modelId;

    // per-Individual
    List<JsonOwlIndividual> iObjs = new ArrayList<JsonOwlIndividual>();
    for (OWLNamedIndividual i : ont.getIndividualsInSignature()) {
        iObjs.add(renderObject(i));
    }
    json.individuals = iObjs.toArray(new JsonOwlIndividual[iObjs.size()]);

    // per-Assertion
    Set<OWLObjectProperty> usedProps = new HashSet<OWLObjectProperty>();

    List<JsonOwlFact> aObjs = new ArrayList<JsonOwlFact>();
    for (OWLObjectPropertyAssertionAxiom opa : ont.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION)) {
        JsonOwlFact fact = renderObject(opa);
        if (fact != null) {
            aObjs.add(fact);
            usedProps.addAll(opa.getObjectPropertiesInSignature());
        }
    }
    json.facts = aObjs.toArray(new JsonOwlFact[aObjs.size()]);

    JsonAnnotation[] anObjs = renderAnnotations(ont.getAnnotations(), curieHandler);
    if (anObjs != null && anObjs.length > 0) {
        json.annotations = anObjs;
    }

    return json;

}
项目:minerva    文件:CoreMolecularModelManager.java   
/**
 * @param f
 * @param p
 * @param i
 * @param j
 * @param annotations
 * @return axiom
 */
public static OWLObjectPropertyAssertionAxiom createFact(OWLDataFactory f,
        OWLObjectPropertyExpression p, OWLIndividual i, OWLIndividual j,
        Set<OWLAnnotation> annotations) {
    final OWLObjectPropertyAssertionAxiom axiom;
    if (annotations != null && !annotations.isEmpty()) {
        axiom = f.getOWLObjectPropertyAssertionAxiom(p, i, j, annotations); 
    }
    else {
        axiom = f.getOWLObjectPropertyAssertionAxiom(p, i, j);
    }
    return axiom;
}
项目:minerva    文件:CoreMolecularModelManager.java   
public void addAnnotations(ModelContainer model, OWLObjectPropertyExpression p,
        OWLNamedIndividual i, OWLNamedIndividual j, Set<OWLAnnotation> annotations,
        METADATA metadata) {
    OWLOntology ont = model.getAboxOntology();
    Set<OWLObjectPropertyAssertionAxiom> axioms = ont.getObjectPropertyAssertionAxioms(i);
    OWLObjectPropertyAssertionAxiom toModify = null;
    for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
        if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
            toModify = axiom;
            break;
        }
    }
    addAnnotations(model, toModify, annotations, metadata);
}
项目:minerva    文件:CoreMolecularModelManager.java   
void addAnnotations(ModelContainer model, OWLObjectPropertyAssertionAxiom toModify,
        Set<OWLAnnotation> annotations, METADATA metadata) {
    if (toModify != null) {
        Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>(annotations);
        combindedAnnotations.addAll(toModify.getAnnotations());
        modifyAnnotations(toModify, combindedAnnotations, model, metadata);
    }
}
项目:minerva    文件:CoreMolecularModelManager.java   
public void updateAnnotation(ModelContainer model, OWLObjectPropertyExpression p,
        OWLNamedIndividual i, OWLNamedIndividual j, OWLAnnotation update,
        METADATA metadata) {
    OWLOntology ont = model.getAboxOntology();
    Set<OWLObjectPropertyAssertionAxiom> axioms = ont.getObjectPropertyAssertionAxioms(i);
    OWLObjectPropertyAssertionAxiom toModify = null;
    for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
        if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
            toModify = axiom;
            break;
        }
    }
    updateAnnotation(model, toModify, update, metadata);
}
项目:minerva    文件:CoreMolecularModelManager.java   
private OWLObjectPropertyAssertionAxiom modifyAnnotations(OWLObjectPropertyAssertionAxiom axiom, 
        Set<OWLAnnotation> replacement, 
        ModelContainer model, METADATA metadata) {
    OWLOntology ont = model.getAboxOntology();
    OWLDataFactory f = model.getOWLDataFactory();
    List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(2);
    changes.add(new RemoveAxiom(ont, axiom));
    OWLObjectPropertyAssertionAxiom newAxiom = 
            f.getOWLObjectPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), axiom.getObject(), replacement);
    changes.add(new AddAxiom(ont, newAxiom));
    applyChanges(model, changes, metadata);
    return newAxiom;
}
项目:minerva    文件:MolecularModelManager.java   
public Set<OWLObjectPropertyAssertionAxiom> updateAnnotation(ModelContainer model, Set<OWLObjectPropertyAssertionAxiom> axioms, OWLAnnotation annotation, METADATA metadata) {
    Set<OWLObjectPropertyAssertionAxiom> newAxioms = new HashSet<OWLObjectPropertyAssertionAxiom>();
    for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
        OWLObjectPropertyAssertionAxiom newAxiom = 
                updateAnnotation(model, axiom, annotation, metadata);
        if (newAxiom != null) {
            newAxioms.add(newAxiom);
        }
    }
    return newAxioms;
}
项目:logmap-matcher    文件:StructuralReasoner2.java   
public NodeSet<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual ind, OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
    ensurePrepared();
    OWLNamedIndividualNodeSet result = new OWLNamedIndividualNodeSet();
    Node<OWLObjectPropertyExpression> inverses = getInverseObjectProperties(pe);
    for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
        for (OWLObjectPropertyAssertionAxiom axiom : ontology.getObjectPropertyAssertionAxioms(ind)) {
            if (!axiom.getObject().isAnonymous()) {
                if (axiom.getProperty().getSimplified().equals(pe.getSimplified())) {
                    if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
                        result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
                    }
                    else {
                        result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
                    }
                }
            }
            // Inverse of pe
            if (axiom.getObject().equals(ind) && !axiom.getSubject().isAnonymous()) {
                OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty().getSimplified();
                if (!invPe.isAnonymous() && inverses.contains(invPe.asOWLObjectProperty())) {
                    if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
                        result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
                    }
                    else {
                        result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
                    }
                }
            }

        }
    }
    // Could do other stuff like inspecting owl:hasValue restrictions
    return result;
}
项目:HermiT-android    文件:EntailmentChecker.java   
public Boolean visit(OWLObjectPropertyAssertionAxiom axiom) {
    OWLIndividual sub=axiom.getSubject();
    OWLIndividual obj=axiom.getObject();
    if (sub.isAnonymous()||obj.isAnonymous()) {
        anonymousIndividualAxioms.add(axiom);
        return true; // will be checked afterwards by rolling-up
    }
    return reasoner.hasObjectPropertyRelationship(sub.asOWLNamedIndividual(),axiom.getProperty(),obj.asOWLNamedIndividual());
}
项目:elk-reasoner    文件:AbstractElkObjectConverter.java   
@Override
public OWLObjectPropertyAssertionAxiom visit(
        ElkObjectPropertyAssertionAxiom axiom) {
    return owlFactory_.getOWLObjectPropertyAssertionAxiom(
            convert(axiom.getProperty()), convert(axiom.getSubject()),
            convert(axiom.getObject()));
}
项目:elk-reasoner    文件:AbstractOwlAxiomConverterVisitor.java   
@Override
public T visit(OWLObjectPropertyAssertionAxiom axiom) {
    throw new IllegalArgumentException(
            OWLObjectPropertyAssertionAxiom.class.getSimpleName()
                    + " cannot be converted to "
                    + getTargetClass().getSimpleName());
}
项目:Hermit_1.3.8_android    文件:EntailmentChecker.java   
public Boolean visit(OWLObjectPropertyAssertionAxiom axiom) {
    OWLIndividual sub=axiom.getSubject();
    OWLIndividual obj=axiom.getObject();
    if (sub.isAnonymous()||obj.isAnonymous()) {
        anonymousIndividualAxioms.add(axiom);
        return true; // will be checked afterwards by rolling-up
    }
    return reasoner.hasObjectPropertyRelationship(sub.asOWLNamedIndividual(),axiom.getProperty(),obj.asOWLNamedIndividual());
}
项目:owltools    文件:OwlHelper.java   
public static Map<OWLObjectPropertyExpression, Set<OWLIndividual>> getObjectPropertyValues(OWLIndividual i, OWLOntology ont) {
    Set<OWLObjectPropertyAssertionAxiom> axioms = ont.getObjectPropertyAssertionAxioms(i);
    Map<OWLObjectPropertyExpression, Set<OWLIndividual>> result = new HashMap<>();
    for(OWLObjectPropertyAssertionAxiom ax : axioms) {
        Set<OWLIndividual> inds = result.get(ax.getProperty());
        if (inds == null) {
            inds = new HashSet<>();
            result.put(ax.getProperty(), inds);
        }
        inds.add(ax.getObject());
    }
    return result;
}
项目:owltools    文件:LegoTools.java   
public List<LegoNode> createLegoNodes(Collection<OWLNamedIndividual> individuals) throws UnExpectedStructureException {
    List<LegoNode> nodes = new ArrayList<LegoNode>(individuals.size());
    Set<OWLOntology> ontologies = new HashSet<OWLOntology>(graph.getAllOntologies());
    for (OWLNamedIndividual individual : individuals) {
        Set<OWLClassAssertionAxiom> axioms = getClassAxioms(individual, ontologies);
        final LegoNode node = createNode(individual, axioms, ontologies);
        if (node != null) {
            // links
            List<LegoLink> links = new ArrayList<LegoLink>();
            Set<OWLObjectPropertyAssertionAxiom> propertyAxioms = getPropertyAxioms(individual, ontologies);
            for (OWLObjectPropertyAssertionAxiom propertyAxiom : propertyAxioms) {
                OWLIndividual object = propertyAxiom.getObject();
                if (object instanceof OWLNamedIndividual == false) {
                    throw new UnExpectedStructureException("Expected a named individual for a link: "+propertyAxiom);
                }
                OWLNamedIndividual namedTarget = (OWLNamedIndividual) object;
                OWLObjectPropertyExpression property = propertyAxiom.getProperty();
                LegoLink link = new LegoLink(individual, namedTarget, property);
                LegoMetadata.extractMetadata(link, propertyAxiom);
                links.add(link);
            }
            if (!links.isEmpty()) {
                node.setLinks(links);
            }

            nodes.add(node);
        }
    }

    return nodes;
}
项目:owltools    文件:LegoTools.java   
private Set<OWLObjectPropertyAssertionAxiom> getPropertyAxioms(OWLNamedIndividual individual, Set<OWLOntology> ontologies) {
    Set<OWLObjectPropertyAssertionAxiom> propertyAxioms = new HashSet<OWLObjectPropertyAssertionAxiom>();
    for(OWLOntology o : ontologies) {
        propertyAxioms.addAll(o.getObjectPropertyAssertionAxioms(individual));
    }
    return propertyAxioms;
}
项目:owltools    文件:LegoTools.java   
private Set<OWLObjectPropertyAssertionAxiom> getAllPropertyAssertionAxioms(Set<OWLOntology> ontologies) {
    Set<OWLObjectPropertyAssertionAxiom> axioms = new HashSet<OWLObjectPropertyAssertionAxiom>();
    for(OWLOntology o : ontologies) {
        axioms.addAll(o.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION));
    }
    return axioms;
}
项目:owltools    文件:LegoUnitTools.java   
private Set<OWLObjectPropertyAssertionAxiom> getPropertyAxioms(OWLNamedIndividual individual) {
    Set<OWLObjectPropertyAssertionAxiom> propertyAxioms = new HashSet<OWLObjectPropertyAssertionAxiom>();
    for(OWLOntology o : graph.getAllOntologies()) {
        propertyAxioms.addAll(o.getObjectPropertyAssertionAxioms(individual));
    }
    return propertyAxioms;
}
项目:jcel    文件:AxiomTranslator.java   
@Override
public Set<ComplexIntegerAxiom> visit(OWLObjectPropertyAssertionAxiom axiom) {
    Objects.requireNonNull(axiom);
    IntegerObjectPropertyExpression propertyExpr = translateObjectPropertyExpression(axiom.getProperty());
    Integer subjectId = translateIndividual(axiom.getSubject());
    Integer objectId = translateIndividual(axiom.getObject());
    ComplexIntegerAxiom ret = getAxiomFactory().createObjectPropertyAssertionAxiom(propertyExpr, subjectId,
            objectId, translateAnnotations(axiom.getAnnotations()));
    return Collections.singleton(ret);
}
项目:owlapi-gwt    文件:HashCode.java   
@Override
public void visit(OWLObjectPropertyAssertionAxiom axiom) {
    hashCode = primes[23];
    hashCode = hashCode * MULT + axiom.getSubject().hashCode();
    hashCode = hashCode * MULT + axiom.getProperty().hashCode();
    hashCode = hashCode * MULT + axiom.getObject().hashCode();
    hashCode = hashCode * MULT + axiom.getAnnotations().hashCode();
}
项目:owlapi-gwt    文件:AbstractEntityRegistrationManager.java   
@Override
public void visit(@Nonnull OWLObjectPropertyAssertionAxiom axiom) {
    axiom.getSubject().accept(this);
    axiom.getProperty().accept(this);
    axiom.getObject().accept(this);
    processAxiomAnnotations(axiom);
}
项目:owlapi-gwt    文件:OWLObjectPropertyAssertionAxiomImpl.java   
@Override
public OWLObjectPropertyAssertionAxiom getAxiomWithoutAnnotations() {
    if (!isAnnotated()) {
        return this;
    }
    return new OWLObjectPropertyAssertionAxiomImpl(getSubject(),
            getProperty(), getObject(), NO_ANNOTATIONS);
}
项目:owlapi-gwt    文件:OWLObjectPropertyAssertionAxiomImpl.java   
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!super.equals(obj)) {
        return false;
    }
    return obj instanceof OWLObjectPropertyAssertionAxiom;
}
项目:owlapi-gwt    文件:OWLObjectPropertyAssertionAxiomImpl.java   
@Override
public OWLObjectPropertyAssertionAxiom getSimplified() {
    if (!getProperty().isAnonymous()) {
        return this;
    } else {
        OWLObjectInverseOf property = (OWLObjectInverseOf) getProperty();
        OWLObjectPropertyExpression invProp = property.getInverse();
        return new OWLObjectPropertyAssertionAxiomImpl(getObject(),
                invProp, getSubject(), NO_ANNOTATIONS);
    }
}
项目:ppinot    文件:GeneratePpinotAxioms.java   
/**
 * Genera los axiomas correspondientes a una medida CountInstanceMeasure
 * 
 * @param element Objeto del modelo de la medida
 * @param bpmn20ModelHandler Manejador del modelo BPMN correspondiente al mismo proceso de la medida
 * @return Objeto OWL de la medida
 * @throws Exception
 */
OWLNamedIndividual converterCountInstanceMeasureOWL(CountInstanceMeasure element, Bpmn20ModelHandlerInterface bpmn20ModelHandler) throws Exception 
{

    String nameCountMeasure= element.getId();

    Boolean endActivity = element.getWhen().getChangesToState().getState()==GenericState.END;

       String elementName = element.getWhen().getAppliesTo();
       String type = this.getNameTypeActivity(elementName, bpmn20ModelHandler);

    // adiciona el axioma con la medida
       OWLNamedIndividual measureIndividual = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+nameCountMeasure) );
       OWLClass measureClass = factory.getOWLClass(IRI.create(Vocabulary.COUNTMEASURE_URI));
       OWLClassAssertionAxiom classAssertionAxiom = factory.getOWLClassAssertionAxiom(measureClass, measureIndividual);
       manager.addAxiom(ontology, classAssertionAxiom);

    // adiciona el axioma que indica el momento en que se aplica la medida
       OWLNamedIndividual whenPropertyIndividual = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+Vocabulary.TIMEINSTANT+nameCountMeasure) );
       OWLObjectPropertyExpression whenObjectProperty = factory.getOWLObjectProperty( IRI.create(Vocabulary.WHEN_URI) );
       OWLObjectPropertyAssertionAxiom whenObjectPropertyAssertionAxiom = factory.getOWLObjectPropertyAssertionAxiom(whenObjectProperty, measureIndividual, whenPropertyIndividual);
       manager.addAxiom(ontology, whenObjectPropertyAssertionAxiom);

       // adiciona el axioma que indica la clase del momento en que se aplica la medida
       IRI classIri = this.timeInstantClassIRI(type, endActivity);
       OWLClass timeInstantClass = factory.getOWLClass(classIri);
       OWLClassAssertionAxiom timeInstantClassAssertionAxiom = factory.getOWLClassAssertionAxiom(timeInstantClass, whenPropertyIndividual);
       manager.addAxiom(ontology, timeInstantClassAssertionAxiom);  

       // adiciona el axioma que indica que la propiedad appliesTo del individual whenPropertyIndividual tiene el valor bpmnElement
       OWLNamedIndividual bpmnElement = factory.getOWLNamedIndividual( IRI.create(bpmnGeneratedOntologyURI+"#"+elementName) );
       OWLObjectPropertyExpression appliesToObjectProperty = factory.getOWLObjectProperty(IRI.create(Vocabulary.APPLIESTO_URI));
       OWLObjectPropertyAssertionAxiom propertyAssertionappliesTo = factory.getOWLObjectPropertyAssertionAxiom(appliesToObjectProperty, whenPropertyIndividual, bpmnElement);
       manager.addAxiom(ontology, propertyAssertionappliesTo);

       // devuelve el individual de la medida
       return measureIndividual;
}
项目:ppinot    文件:GeneratePpinotAxioms.java   
/**
 * Genera los axiomas correspondientes a una medida StateConditionInstanceMeasure
 * 
 * @param element Objeto del modelo de la medida
 * @param bpmn20ModelHandler Manejador del modelo BPMN correspondiente al mismo proceso de la medida
 * @return Objeto OWL de la medida
 * @throws Exception
 */
OWLNamedIndividual converterStateConditionInstanceMeasureOWL(StateConditionInstanceMeasure element, Bpmn20ModelHandlerInterface bpmn20ModelHandler) throws Exception 
{

    String nameElementCondMeasure= element.getId();

    String activity = ((StateCondition) element.getCondition()).getAppliesTo();
    String restriction = this.getCleanRestriction( ((StateCondition) element.getCondition()).getState().getStateString() );

       // adiciona el axioma de la clase de la medida
       OWLNamedIndividual DataObjNameIndividualMeasure = factory.getOWLNamedIndividual(IRI.create(ppinotGeneratedOntologyURI+"#"+nameElementCondMeasure));
       OWLClass classCountMeasure = factory.getOWLClass( IRI.create(Vocabulary.STATECONDITIONMEASURE_URI)) ;
       OWLClassAssertionAxiom classAssertionCountMeasure = factory.getOWLClassAssertionAxiom(classCountMeasure, DataObjNameIndividualMeasure);
       manager.addAxiom(ontology, classAssertionCountMeasure);

       // adiciona el axioma con la restriccion de la medida
       OWLNamedIndividual dataObjectInstant = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+nameElementCondMeasure+restriction) );
       OWLObjectPropertyExpression meetsIC = factory.getOWLObjectProperty(IRI.create(Vocabulary.MEETS_URI));
       OWLObjectPropertyAssertionAxiom propertyAssertionmeets = factory.getOWLObjectPropertyAssertionAxiom(meetsIC, DataObjNameIndividualMeasure, dataObjectInstant);
       manager.addAxiom(ontology, propertyAssertionmeets);

       // adiciona el axioma con la clase de la restriccion
       OWLClass restrictionClass = factory.getOWLClass( IRI.create(Vocabulary.STATECONDITION_URI)) ;
       OWLClassAssertionAxiom restrictionClassAssertionAxiom = factory.getOWLClassAssertionAxiom(restrictionClass, dataObjectInstant);
       manager.addAxiom(ontology, restrictionClassAssertionAxiom);

       // adiciona el axioma que indica a que elemento se aplica la medida
       OWLNamedIndividual dataObjectElement = factory.getOWLNamedIndividual( IRI.create(bpmnGeneratedOntologyURI+"#"+activity) );
       OWLObjectPropertyExpression appliesTo = factory.getOWLObjectProperty(IRI.create(Vocabulary.APPLIESTO_URI));
       OWLObjectPropertyAssertionAxiom propertyAssertionappliesTo = factory.getOWLObjectPropertyAssertionAxiom(appliesTo, dataObjectInstant, dataObjectElement);
       manager.addAxiom(ontology, propertyAssertionappliesTo);

       return DataObjNameIndividualMeasure;
}
项目:ppinot    文件:GeneratePpinotAxioms.java   
/**
 * Genera los axiomas correspondientes a una medida DataPropertyConditionInstanceMeasure
 * 
 * @param element Objeto del modelo de la medida
 * @param bpmn20ModelHandler Manejador del modelo BPMN correspondiente al mismo proceso de la medida
 * @return Objeto OWL de la medida
 * @throws Exception
 */
OWLIndividual converterDataPropertyConditionInstanceMeasureOWL(DataPropertyConditionInstanceMeasure element) 
{

    String nameDataCondMeasure = element.getId();

    String dataObject = ((DataPropertyCondition) element.getCondition()).getAppliesTo();

    String restriction = this.getCleanRestriction( ((DataPropertyCondition) element.getCondition()).getRestriction() ); 

    // adiciona el axioma que indica la clase de la medida
    OWLNamedIndividual DataObjNameIndividualMeasure = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+nameDataCondMeasure) );
       OWLClass classCountMeasure = factory.getOWLClass( IRI.create(Vocabulary.DATAPROPERTYCONDITIONMEASURE_URI)) ;
       OWLClassAssertionAxiom classAssertionCountMeasure = factory.getOWLClassAssertionAxiom(classCountMeasure, DataObjNameIndividualMeasure);
       manager.addAxiom(ontology, classAssertionCountMeasure);

    // adiciona el axioma de la restriccion de la medida
       OWLObjectPropertyExpression meetsIC = factory.getOWLObjectProperty(IRI.create(Vocabulary.MEETS_URI));
       OWLNamedIndividual dataObjectInstant = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+nameDataCondMeasure+restriction) );
       OWLObjectPropertyAssertionAxiom propertyAssertionmeets = factory.getOWLObjectPropertyAssertionAxiom(meetsIC, DataObjNameIndividualMeasure, dataObjectInstant);
       manager.addAxiom(ontology, propertyAssertionmeets);

       // adiciona el axioma con la clase de la restriccion
       OWLClass restrictionClass = factory.getOWLClass( IRI.create(Vocabulary.DATAPROPERTYCONDITION_URI)) ;
       OWLClassAssertionAxiom restrictionClassAssertionAxiom = factory.getOWLClassAssertionAxiom(restrictionClass, dataObjectInstant);
       manager.addAxiom(ontology, restrictionClassAssertionAxiom);

       // adiciona el axioma que indica el elemento al que se aplica la medida
       OWLObjectPropertyExpression appliesTo = factory.getOWLObjectProperty(IRI.create(Vocabulary.APPLIESTO_URI));
       OWLNamedIndividual dataObjectElement = factory.getOWLNamedIndividual( IRI.create(bpmnGeneratedOntologyURI+"#"+dataObject) );
       OWLObjectPropertyAssertionAxiom propertyAssertionappliesTo = factory.getOWLObjectPropertyAssertionAxiom(appliesTo, dataObjectInstant, dataObjectElement);
       manager.addAxiom(ontology, propertyAssertionappliesTo);  

       return DataObjNameIndividualMeasure;
}