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

项目:Source    文件:OntoModel.java   
private OWLProperty getExistingProperty(String relationName) {
    for (String relationNamewithCase : generateCaseCombinationsSimple(relationName)) {
        for (String nameSpace : nameSpaces.values()) {
            IRI fetchIRI = IRI.create(nameSpace + relationNamewithCase);
            if (ontology.containsDataPropertyInSignature(fetchIRI)) {
                // consider properties as new if they are not present in the initial ontology
                if (initialProperties.contains(dataFactory.getOWLObjectProperty(fetchIRI))) {
                    existingRelations.add(fetchIRI.toString() + "\n");
                }
                countExistingRelations += 1; // for a current axiom, take into account current state of
                                                // the ontology
                return dataFactory.getOWLDataProperty(fetchIRI);
            }
            if (ontology.containsObjectPropertyInSignature(fetchIRI)) {
                // consider properties as new if they are not present in the initial ontology
                if (initialProperties.contains(dataFactory.getOWLObjectProperty(fetchIRI))) {
                    existingRelations.add(fetchIRI.toString() + "\n");
                }
                countExistingRelations += 1;
                return dataFactory.getOWLObjectProperty(fetchIRI);
            }
        }
    }
    return null; // return null if nothing matches.
}
项目:Source    文件:OntoModel.java   
private Object[] addRelations(Set<String> relationNames) {
    // search for relations and add them if they don't exist
    List<String> newRelationsInAxiom = new ArrayList<String>();
    List<String> existingRelationsInAxiom = new ArrayList<String>();
    for (String relationName : relationNames) {
        String relationNameNoColon = relationName.replace(":", "");
        // disallow MWE, but keep track of the original relation in entitiesToUri
        String relationNameNoMwe = relationNameNoColon.replace("_+_", "_");
        OWLProperty property = getExistingProperty(relationNameNoMwe);
        if (property == null) {
            addNewObjectProperty(relationNameNoMwe);
            entitiesToUri.put(relationNameNoColon, "<http://airbus-group.installsys/component#"
                    + relationNameNoMwe + ">");
            log.log(Level.FINER,
                    "add a new property to the ontology: <http://airbus-group.installsys/component#"
                            + relationNameNoMwe + ">");
            newRelationsInAxiom.add(relationNameNoMwe);
        } else {
            entitiesToUri.put(relationNameNoColon, property.toString());
            existingRelationsInAxiom.add(relationNameNoMwe);
        }
    }
    return new Object[] {existingRelationsInAxiom, newRelationsInAxiom };
}
项目:owltools    文件:OntologySolrLoader.java   
public SolrInputDocument collect(OWLObject obj, OWLGraphWrapper graph) {

        SolrInputDocument cls_doc = new SolrInputDocument();

        // General for all ontology objects.
        cls_doc.addField("id", graph.getIdentifier(obj));
        cls_doc.addField("label", graph.getLabel(obj));
        cls_doc.addField("description", graph.getDef(obj));

        if (obj instanceof OWLClass)
             collectClass(cls_doc, graph, (OWLClass)obj);
        else if (obj instanceof OWLIndividual)
             collectIndividual(cls_doc, (OWLIndividual)obj);
        else if (obj instanceof OWLProperty)
             collectProperty(cls_doc, (OWLProperty)obj);
        return cls_doc; 
    }
项目:gate-semano    文件:OntologyParser.java   
private OWLProperty findRegisteredProperty(String uriencoded) {
    String uri = uriencoded;
    OWLProperty classOWL = null;
    ONodeID nodeid = null;
    try {
        nodeid = new ONodeIDImpl(uri, false);
    } catch (Exception e) {
        // find

        nodeid = new ONodeIDImpl(uri, false);
    }
    if (nodeid != null && this.annotationProperties.containsValue(nodeid)) {

        for (Entry<OWLDataProperty, Property> entry : dataProperties.entrySet()) {
            if (entry.getValue().equals(nodeid)) {
                classOWL = entry.getKey();
            }
        }

    }

    return classOWL;
}
项目:OntoBench    文件:UnboundObjectPropertyFeature.java   
@Override
public void addToOntology() {
  OWLProperty property = featurePool.getExclusiveProperty(":noDomainAndRangeObjectProperty");
  OWLAxiom axiom = factory.getOWLDeclarationAxiom(property);

  addAxiomToOntology(axiom);
}
项目:owltools    文件:XgmmlWriter.java   
private void writeEdges(XMLStreamWriter writer, OWLObject c, List<OWLObject> allClasses, OWLGraphWrapper graph, List<GafDocument> gafs) throws XMLStreamException {

        String id = getId(graph.getIdentifier(c));
        Set<OWLGraphEdge> edges = graph.getOutgoingEdges(c);
        for (OWLGraphEdge owlGraphEdge : edges) {
            OWLObject target = owlGraphEdge.getTarget();
            if (!allClasses.contains(target))
                continue;
            String tid = getId(graph.getIdentifier(target));
            OWLQuantifiedProperty qp = owlGraphEdge.getSingleQuantifiedProperty();
            OWLProperty p = qp.getProperty();
            String pid;
            if (p == null) {
                pid = qp.getQuantifier().toString();
            }
            else {
                pid = getId(graph.getIdentifier(p));
                if (pid == null) {
                    pid = "UNK";
                }
            }
            String eid = id+" ("+pid+") "+tid;
            writer.writeStartElement("edge");
            writer.writeAttribute("id", eid);
            writer.writeAttribute("label", eid);
            writer.writeAttribute("source", id);
            writer.writeAttribute("target", tid);
            writer.writeStartElement("att");
            writer.writeAttribute("name","interaction");
            writer.writeAttribute("value",pid);
            writer.writeEndElement(); // att

            writer.writeEndElement(); // edge

        }
    }
项目:owltools    文件:PropertyExtractor.java   
/**
 * 
 * @param newIRI
 * @return ontology
 * @throws OWLOntologyCreationException
 */
public OWLOntology extractPropertyOntology(IRI newIRI) throws OWLOntologyCreationException {
    Set<OWLProperty> props = new HashSet<OWLProperty>();
    for (OWLObjectProperty p : mainOntology.getObjectPropertiesInSignature(Imports.INCLUDED)) {
        LOG.info("mainOntology contains: "+p);
        props.add(p);
    }
    return extractPropertyOntology(newIRI, props);
}
项目:align-api-project    文件:OWLAPI3Ontology.java   
public Set<Object> getSubProperties(Object pr, int local, int asserted, int named) {
    Set<Object> sbpr = new HashSet<Object>();
    for (Object p : getProperties()) {
        if (getSuperProperties((OWLProperty) p, local, asserted, named).contains(pr)) sbpr.add(p);
    }
    return sbpr;
}
项目:align-api-project    文件:OWLAPI3Ontology.java   
public Set<Object> getRange(Object p, int asserted) {
    Set<Object> resultSet = new HashSet<Object>();
    for (Object ent : ((OWLProperty) p).getRanges(getOntology())) {
        // Not correct
        // Could be something else than class
        if (ent instanceof OWLClass || ent instanceof OWLDatatype) {
            resultSet.add(ent);
        }
    }
    return resultSet;
}
项目:align-api-project    文件:OWLAPI3Ontology.java   
public Set<Object> getDomain(Object p, int asserted) {
    Set<Object> resultSet = new HashSet<Object>();
    for (Object ent : ((OWLProperty) p).getDomains(getOntology())) {
        // Not correct
        // Could be something else than class
        if (ent instanceof OWLClass) {
            resultSet.add(ent);
        }
    }
    return resultSet;
}
项目:OntoBench    文件:UnboundDataPropertyFeature.java   
@Override
public void addToOntology() {
  OWLProperty property = factory.getOWLDataProperty(":noDomainAndRangeDataProperty", pm);

  addAxiomToOntology(factory.getOWLDeclarationAxiom(property));
}
项目:owltools    文件:OntologySolrLoader.java   
private void collectProperty(SolrInputDocument d, OWLProperty obj) {
}
项目:align-api-project    文件:OWLAPI3Ontology.java   
public boolean isProperty(Object o) {
    return o instanceof OWLProperty;
}