Set<OWLNamedIndividual> inds=localOntology.getIndividualsInSignature(); for (OWLNamedIndividual ind: inds){ System.out.println(ind.getObjectPropertyValues(localOntology)); }
OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLDataFactory factory = manager.getDataFactory(); Set<OWLNamedIndividual> inds = localOntology.getIndividualsInSignature(); for (OWLNamedIndividual ind: inds){ System.out.println(ind.getObjectPropertyValues(factory.getOWLObjectProperty(IRI.create("Put the iri of the property here")), localOntology)); }
public Map<Property,Collection<LiteralOrIndividual>> getProperties() { HashMap<Property,Collection<LiteralOrIndividual>> rval = new HashMap<Property,Collection<LiteralOrIndividual>>(); rval.putAll(convertDP2M(indiv.getDataPropertyValues(onto))); rval.putAll(convertOP2M(indiv.getObjectPropertyValues(onto))); return Collections.unmodifiableMap(rval); } public Collection<LiteralOrIndividual> getPropertyValues(Property property) {
@Override public Collection<OWLNamedIndividual> getPropertyValues(OWLNamedIndividual i, OWLObjectProperty p) { Collection<OWLNamedIndividual> results = new HashSet<OWLNamedIndividual>(); for (OWLOntology imported : ontology.getImportsClosure()) { for (OWLIndividual j : i.getObjectPropertyValues(p, imported)) { if (!j.isAnonymous()) { results.add(j.asOWLNamedIndividual()); } } } return results; }
private void unreifyRelationInstances() { if (artifactToUnreifiedRels != null) { return; } artifactToUnreifiedRels = new HashMap<OWLNamedIndividual, Set<GraphArc>>(); for(OWLNamedIndividual individual : owlOntology.getIndividualsInSignature()) { for(Entry<OWLObjectPropertyExpression, Set<OWLIndividual>> entry : individual.getObjectPropertyValues(owlOntology).entrySet()) { for(OWLIndividual refIndividual : entry.getValue()) { GraphArc arc = createArc((OWLNamedIndividual)individual, (OWLNamedIndividual)refIndividual, owlModelManager.getRendering(entry.getKey())); Set<GraphArc> outgoingUnreifiedRels = artifactToUnreifiedRels.get(individual); if (outgoingUnreifiedRels == null) { outgoingUnreifiedRels = new HashSet<GraphArc>(); artifactToUnreifiedRels.put(individual, outgoingUnreifiedRels); } outgoingUnreifiedRels.add(arc); Set<GraphArc> incomingUnreifiedRels = artifactToUnreifiedRels.get(refIndividual); if (incomingUnreifiedRels == null) { incomingUnreifiedRels = new HashSet<GraphArc>(); artifactToUnreifiedRels.put((OWLNamedIndividual)refIndividual, incomingUnreifiedRels); } incomingUnreifiedRels.add(arc); } } } }
private void printObjectPropertyValues(StringBuffer sb, ShortFormProvider provider) { Map<OWLObjectPropertyExpression, Set<OWLIndividual>> valueMap = new TreeMap<OWLObjectPropertyExpression, Set<OWLIndividual>>(owlIndividual.getObjectPropertyValues(owlOntology)); for (Entry<OWLObjectPropertyExpression, Set<OWLIndividual>> entry : valueMap.entrySet()) { OWLObjectPropertyExpression pe = entry.getKey(); Set<OWLIndividual> values = entry.getValue(); if (!pe.isAnonymous()) { OWLObjectProperty property = pe.asOWLObjectProperty(); sb.append(provider.getShortForm(property)); sb.append(": "); boolean firstTime = true; for (OWLIndividual value : values) { if (!value.isAnonymous()) { if (firstTime) { firstTime = false; } else { sb.append(", "); } sb.append(provider.getShortForm(value.asOWLNamedIndividual())); } } sb.append("; "); } } }
public Collection<LiteralOrIndividual> getPropertyValues(Property property) { if(property instanceof DatatypeProperty) { return convertLOI(indiv.getDataPropertyValues(convert((DatatypeProperty)property),onto)); } else if(property instanceof ObjectProperty) { return convertLOI(indiv.getObjectPropertyValues(convert((ObjectProperty)property),onto)); } else { return convertA2LOI(entity().getAnnotations(onto,convert((AnnotationProperty)property))); } } public boolean addProperty(Property property, LiteralOrIndividual value) {
Map<OWLObjectPropertyExpression, Set<OWLIndividual>> objPropAssertions = individual.getObjectPropertyValues(ontology); for (OWLObjectPropertyExpression p : objPropAssertions.keySet()) { if (!p.isAnonymous()) {
Map<OWLObjectPropertyExpression, Set<OWLIndividual>> objPropAssertions = individual.getObjectPropertyValues(ontology); for (OWLObjectPropertyExpression p : objPropAssertions.keySet()) { if (!p.isAnonymous()) {
Map<OWLObjectPropertyExpression, Set<OWLIndividual>> objPropAssertions = individual.getObjectPropertyValues(ontology); for (OWLObjectPropertyExpression p : objPropAssertions.keySet()) { if (!p.isAnonymous()) {
for( OWLIndividual object : x.getObjectPropertyValues( hasSynonym, ontology ) ) { for ( OWLAnnotationAssertionAxiom aAxiom : ontology.getAnnotationAssertionAxioms( (OWLAnnotationSubject) object ) ) { if ( aAxiom.getProperty().equals( factory.getRDFSLabel() ) ) {