protected void importDataProperty(OWLOntology o, OWLDataProperty dataTypeProperty) { String propertyIRI = dataTypeProperty.getIRI().toString(); String propertyDisplayName = getLabel(o, dataTypeProperty); PropertyType propertyType = getPropertyType(o, dataTypeProperty); boolean userVisible = getUserVisible(o, dataTypeProperty); boolean searchable = getSearchable(o, dataTypeProperty); Boolean displayTime = getDisplayTime(o, dataTypeProperty); Double boost = getBoost(o, dataTypeProperty); if (propertyType == null) { throw new LumifyException("Could not get property type on data property " + propertyIRI); } for (OWLClassExpression domainClassExpr : dataTypeProperty.getDomains(o)) { OWLClass domainClass = domainClassExpr.asOWLClass(); String domainClassUri = domainClass.getIRI().toString(); Concept domainConcept = getConceptByIRI(domainClassUri); checkNotNull(domainConcept, "Could not find class with uri: " + domainClassUri); LOGGER.info("Adding data property " + propertyIRI + " to class " + domainConcept.getTitle()); ArrayList<PossibleValueType> possibleValues = getPossibleValues(o, dataTypeProperty); Collection<TextIndexHint> textIndexHints = getTextIndexHints(o, dataTypeProperty); addPropertyTo( domainConcept, propertyIRI, propertyDisplayName, propertyType, possibleValues, textIndexHints, userVisible, searchable, displayTime, boost); } }
protected Concept getParentConcept( OWLOntology o, OWLClass ontologyClass, File inDir, Authorizations authorizations) throws IOException { Set<OWLClassExpression> superClasses = ontologyClass.getSuperClasses(o); if (superClasses.size() == 0) { return getEntityConcept(); } else if (superClasses.size() == 1) { OWLClassExpression superClassExpr = superClasses.iterator().next(); OWLClass superClass = superClassExpr.asOWLClass(); String superClassUri = superClass.getIRI().toString(); Concept parent = getConceptByIRI(superClassUri); if (parent != null) { return parent; } parent = importOntologyClass(o, superClass, inDir, authorizations); if (parent == null) { throw new LumifyException("Could not find or create parent: " + superClass); } return parent; } else { throw new LumifyException( "Unhandled multiple super classes. Found " + superClasses.size() + ", expected 0 or 1."); } }
private Iterable<Concept> getDomainsConcepts(OWLOntology o, OWLObjectProperty objectProperty) { String uri = objectProperty.getIRI().toString(); if (objectProperty.getDomains(o).size() == 0) { throw new LumifyException("Invalid number of domain properties on " + uri); } List<Concept> domains = new ArrayList<Concept>(); for (OWLClassExpression rangeClassExpr : objectProperty.getDomains(o)) { OWLClass rangeClass = rangeClassExpr.asOWLClass(); String rangeClassUri = rangeClass.getIRI().toString(); Concept ontologyClass = getConceptByIRI(rangeClassUri); checkNotNull(ontologyClass, "Could not find class with uri: " + rangeClassUri); domains.add(ontologyClass); } return domains; }