Я пытался найти все вложенные свойства (1 и более уровней) для данного свойства, используя Jena API в Java. Ниже приведена часть файла схемы.
Файл схемы
<!-- http://www.inmindcloud.com/application/schema.owl#calculation -->
<owl:DatatypeProperty rdf:about="&as;calculation">
<rdfs:label rdf:datatype="&xsd;string">calculation</rdfs:label>
<rdfs:comment rdf:datatype="&xsd;string">This is comment</rdfs:comment>
<rdfs:subPropertyOf rdf:resource="&as;businessData"/>
</owl:DatatypeProperty>
Java-код
private static OntModel enhanceCalculableProperties(final OntModel model)
{
final OntProperty businessDataProperty = model.getOntProperty(Schema.businessData.getURI());
final OntProperty calculationProperty = model.getOntProperty(Schema.calculation.getURI());
final List<? extends OntProperty> businessDataSubProperties = businessDataProperty.listSubProperties(false)
.toList();
final List<? extends OntProperty> calculationSubProperties = calculationProperty.listSubProperties().toList();
final boolean containsCalculationProperty = businessDataSubProperties.contains(calculationProperty);
final boolean containsSubProperties = businessDataSubProperties.containsAll(calculationSubProperties);
System.out.println(containsCalculationProperty); // true
System.out.println(containsSubProperties); // false
return model;
}
В соответствии с документацией он должен возвращать все вложенные свойства, а это не так.
Вы можете видеть из приведенного выше кода, содержит SubProperties is false .
Будем благодарны за любые предложения по исправлению.