private boolean isAbstract(OntProperty p) { List<RDFNode> list = p.listPropertyValues(RDF.type).toList(); for (RDFNode node : list) { if (node.canAs(Resource.class)) { Resource r = node.asResource(); if (BindVocabulary.AbstractProperty.getURI().equals(r.getURI())) return true; } } return false; }
private void handleSubpropertyOf(OntProperty p, OntProperty ancestor) { List<RDFNode> list = ancestor.listPropertyValues(RDFS.subPropertyOf).toList(); for (RDFNode node : list) { if (!node.canAs(OntProperty.class)) continue; OntProperty superProperty = node.as(OntProperty.class); if (superProperty.equals(ancestor)) continue; addFields(p, superProperty); handleSubpropertyOf(p, superProperty); } }
private void handlePropertySubclassOf(OntProperty p) { List<RDFNode> list = p.listPropertyValues(RDFS.subClassOf).toList(); for (RDFNode node : list) { if (!node.canAs(Resource.class)) continue; Resource resource = node.asResource(); Resource onPropertyValue = resource.getPropertyResourceValue(OWL.onProperty); if (!RDFS.domain.equals(onPropertyValue)) continue; Resource someValuesFrom = resource.getPropertyResourceValue(OWL.someValuesFrom); if (someValuesFrom == null) continue; String uri = someValuesFrom.getURI(); if (uri != null) { OntResource type = someValuesFrom.as(OntResource.class); addField(type, p, null); } else { Resource unionList = someValuesFrom.getPropertyResourceValue(OWL.unionOf); while (unionList != null) { Resource first = unionList.getPropertyResourceValue(RDF.first); if (first != null) { String typeURI = first.getURI(); if (typeURI == null) { logger.warn( "Cannot handle union that contains an anonymous class in the domain of " + p.getURI()); } else { OntResource type = first.as(OntResource.class); addField(type, p, null); } } unionList = unionList.getPropertyResourceValue(RDF.rest); if (RDF.nil.equals(unionList)) { break; } } } } }