Fix name of property class

This commit is contained in:
Andreas Meier
2026-03-30 07:57:27 +02:00
parent 1f38c46236
commit 94c146e112
3 changed files with 35 additions and 38 deletions
@@ -20,7 +20,7 @@ public class SchemaFacade implements ISchemaFacade
private final static String RDFS_CLASS = "rdfs:Class";
private final static String RDFS_PROPERTY = "rdfs:Property";
private final static String RDF_PROPERTY = "rdf:Property";
public static final String EQUIVALENT_CLASS = "owl:equivalentClass";
@@ -153,7 +153,7 @@ public class SchemaFacade implements ISchemaFacade
DataEntity.DataEntityBuilder builder = new DataEntity.DataEntityBuilder();
builder.setId(rdfsProperty.getId());
builder.addProperty("@type", RDFS_PROPERTY);
builder.addProperty("@type", RDF_PROPERTY);
builder.addProperty(RDFS_LABEL, rdfsProperty.getLabel());
builder.addProperty(RDFS_COMMENT, rdfsProperty.getComment());
@@ -321,44 +321,41 @@ public class SchemaFacade implements ISchemaFacade
entity.getProperty("@id")
.asText();
switch (type)
{
case "rdfs:Property" ->
{
PropertyType rdfsProperty = new PropertyType();
rdfsProperty.setId(resolvePrefixSingleValue(id));
if (type.equals(RDF_PROPERTY) || type.equals("rdfs:Property"))
{
PropertyType rdfsProperty = new PropertyType();
rdfsProperty.setId(resolvePrefixSingleValue(id));
rdfsProperty.setOntologicalAnnotations(
parseMultiValued(entity, EQUIVALENT_CONCEPT));
rdfsProperty.setOntologicalAnnotations(
parseMultiValued(entity, EQUIVALENT_CONCEPT));
List<String> rawRange = parseMultiValued(entity, rangeIdentifier);
List<String> rawRange = parseMultiValued(entity, rangeIdentifier);
List<IDataType> dataTypes = rawRange.stream()
.filter(LiteralType::isLiteralType)
.map(LiteralType::getByTypeName)
.filter(Objects::nonNull)
.collect(Collectors.toList());
List<IType> types = rawRange.stream()
.filter(x -> !LiteralType.isLiteralType(x))
.map(this::resolvePrefixSingleValue)
.map(classes::get)
.collect(Collectors.toList());
List<IDataType> dataTypes = rawRange.stream()
.filter(LiteralType::isLiteralType)
.map(LiteralType::getByTypeName)
.filter(Objects::nonNull)
.collect(Collectors.toList());
List<IType> types = rawRange.stream()
.filter(x -> !LiteralType.isLiteralType(x))
.map(this::resolvePrefixSingleValue)
.map(classes::get)
.collect(Collectors.toList());
dataTypes.stream().forEach(rdfsProperty::addDataType);
types.forEach(rdfsProperty::addType);
dataTypes.stream().forEach(rdfsProperty::addDataType);
types.forEach(rdfsProperty::addType);
rdfsProperty.setDomainIncludes(
parseMultiValued(entity, domainIdentifier).stream()
.map(x -> resolvePrefixSingleValue(x))
.map(classes::get).collect(
Collectors.toList()));
properties.put(resolvePrefixSingleValue(id), rdfsProperty);
rdfsProperty.setDomainIncludes(
parseMultiValued(entity, domainIdentifier).stream()
.map(x -> resolvePrefixSingleValue(x))
.map(classes::get).collect(
Collectors.toList()));
properties.put(resolvePrefixSingleValue(id), rdfsProperty);
}
}
}
for (DataEntity entity : crate.getAllDataEntities())
{
String type = entity.getProperty("@type").asText();
+6 -6
View File
@@ -17,12 +17,12 @@ ex:TypeMustBeClassShape
sh:property [
sh:path rdf:type ;
sh:or (
[ sh:in (rdfs:Class owl:restriction rdfs:Property schema:Dataset schema:CreativeWork ) ] # Case 1: type is exactly rdfs:Class
[ sh:in (rdfs:Class owl:restriction rdf:Property schema:Dataset schema:CreativeWork ) ] # Case 1: type is exactly rdfs:Class
[ sh:class rdfs:Class ] # Case 2: type is a node of type rdfs:Class
) ;
#sh:nodeKind sh:IRI ;
sh:minCount 1 ;
sh:message "type should be either rdfs:Class or owl:restriction or rdfs:Property or a valid reference to a rdfs:Class or "
sh:message "type should be either rdfs:Class or owl:restriction or rdf:Property or a valid reference to a rdfs:Class or "
] .
@@ -59,13 +59,13 @@ ex:ClassDefinitionShape a sh:NodeShape ;
#Check the shape of "owl:restriction"
ex:OwlRestrictionDefinitionShape a sh:NodeShape;
sh:targetClass owl:restriction ;
#owl:onProperty should reference a valid rdfs:Property
#owl:onProperty should reference a valid rdf:Property
sh:property [
sh:path owl:onProperty;
sh:maxCount 1;
sh:minCount 1;
sh:nodeKind sh:IRI;
sh:class rdfs:Property ;
sh:class rdf:Property ;
] ;
sh:property [
sh:path owl:minCardinality ;
@@ -81,7 +81,7 @@ ex:OwlRestrictionDefinitionShape a sh:NodeShape;
] .
ex:PropertyDefinitionShape a sh:NodeShape ;
sh:targetClass rdfs:Property ;
sh:targetClass rdf:Property ;
#sh:closed true;
#sh:ignoredProperties (rdf:type) ;
sh:property [
@@ -97,7 +97,7 @@ ex:PropertyDefinitionShape a sh:NodeShape ;
sh:path owl:equivalentProperty ;
sh:minCount 0 ;
sh:nodeKind sh:IRI ;
#sh:class rdfs:Property ;
#sh:class rdf:Property ;
] ;
sh:property [
sh:path schema:domainIncludes ;
+1 -1
View File
@@ -165,7 +165,7 @@ They also specify, which classes they can interact with.
| Type/Property | Required? | Description |
|------------------------|-----------|---------------------------------------------------------------------------------------------------------|
| @id | MUST | ID of the entry |
| @type | MUST | Is `rdfs:Property` |
| @type | MUST | Is `rdf:Property` |
| owl:equivalentProperty | MAY | Ontological annotation https://www.w3.org/TR/owl-ref/#equivalentClass-def |
| schema:domainIncludes | MUST | Describes the possible types of the subject. This can be one or many. |
| schema:rangeIncludes | MUST | Describes the possible types of the object. This can be one or many. |