/** * returns URIs of all sub-properties of @param propertyUri * @param propertyUri * @param recursive * @return */ public HashMap<String, Label> getSubProperties(String propertyUri, boolean recursive) { HashSet<OntResource> resources = new HashSet<>(); OntResource r = ontModel.getOntProperty(propertyUri); if (r == null) return new HashMap<>(); getChildren(r, resources, recursive); return getResourcesLabels(resources); }
/** * returns URIs of all super-properties of @param propertyUri * @param propertyUri * @param recursive * @return */ public HashMap<String, Label> getSuperProperties(String propertyUri, boolean recursive) { HashSet<OntResource> resources = new HashSet<>(); OntResource r = ontModel.getOntProperty(propertyUri); if (r == null) return new HashMap<>(); getParents(r, resources, recursive); return getResourcesLabels(resources); } }
/** * Returns the predicate for the semantic annotation. * * @return the predicate for the semantic annotation */ public OntProperty getPredicate() { OntModel ontology = getOntology(); if (ontology == null) { return null; } String predicate = semanticAnnotation.getPredicate(); if (predicate == null) { return null; } if (predicate.contains("foaf")) { StringWriter sw = new StringWriter(); ontology.writeAll(sw, null, "RDF/XML"); try { File f = createTempFile("foaf", null); writeStringToFile(f, sw.toString()); } catch (IOException e) { log.info("failed to write foaf ontology to temporary file", e); } } return ontology.getOntProperty(predicate); }
return ontology.getOntProperty(predicate);
OntProperty property = this.ontHandler.getOntModel().getOntProperty(propertyUri); if (property == null || !property.isURIResource()) continue;
allRangesUris = new HashSet<>(); OntProperty property = this.ontHandler.getOntModel().getOntProperty(propertyUri); if (property == null || !property.isURIResource()) continue;
OntProperty p = ontHandler.getOntModel().getOntProperty(subject.getURI()); if (p != null && object.isResource()) { domains.put(p,(Resource)object); OntProperty p = ontHandler.getOntModel().getOntProperty(subject.getURI()); if (p != null && object.isResource()) { ranges.put(p,(Resource)object);