Rules
Try it
owl2sh-closed:CreateNodeShapesAndPropertyShapesFromEquivalentClassHasValue
rdfs:label
owl:equivalentClass/owl:hasValue to sh:NodeShape with sh:hasValue
rdfs:comment
Creates a sh:property shape for each property that is mentioned in an owl:Restriction.
sh:order
1
Try it
owl2sh-closed:CreateNodeShapesAndPropertyShapesFromMatchingDomains
rdfs:label
rdfs:domain to sh:property
rdfs:comment
Creates a NodeShape and a sh:property shape for each property with matching rdfs:domain.
sh:order
2
CONSTRUCT {
$this a sh:NodeShape .
$this a rdfs:Class .
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
}
WHERE {
{
?property rdfs:domain $this .
}
UNION {
?property rdfs:domain/owl:unionOf ?unionOf .
?unionOf rdf:rest*/rdf:first $this .
}
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:CreateNodeShapesAndPropertyShapesFromRestrictions
rdfs:label
owl:onProperty to sh:property
rdfs:comment
Creates a NodeShape and a sh:property shape for each property that is mentioned in an owl:Restriction.
sh:order
1
CONSTRUCT {
$this a sh:NodeShape .
$this a rdfs:Class .
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
}
WHERE {
$this rdfs:subClassOf/owl:onProperty ?property .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:Preprocessing-CopyEquivalentIntersection
rdfs:label
Copy owl:intersectionOfs from owl:equivalentClass
rdfs:comment
Copies any intersections within owl:equivalentClass into the host class itself so that subsequent rules convert them further.
sh:order
-1
CONSTRUCT {
$this owl:intersectionOf ?inter .
}
WHERE {
$this owl:equivalentClass ?equi .
FILTER isBlank(?equi) .
?equi owl:intersectionOf ?inter .
}
Try it
owl2sh-closed:Preprocessing-FlattenIntersectionOf
rdfs:label
Flatten owl:intersectionOf
rdfs:comment
Copies the members of an owl:intersectionOf list as superclasses into the host class itself. Subsequent rules then apply.
sh:order
0
CONSTRUCT {
$this rdfs:subClassOf ?superClass .
}
WHERE {
$this owl:intersectionOf ?list .
?list rdf:rest*/rdf:first ?superClass .
FILTER isBlank(?superClass) .
}
Try it
owl2sh-closed:addIgnoredPropertiesFromSubclassesAndSuperClasses
rdfs:label
Add sh:ignoredProperties with properties from subClasses and super classes.
rdfs:comment
For every ancestor or descendant class of this class, fetch the paths of the associated property shape,
and add this property as an sh:ignoredProperty value of this class.
NOTE : SHACL-Play does a post-processing on this to convert the values of sh:ignoredProperties into an RDF List.
sh:order
10
CONSTRUCT {
$this sh:ignoredProperties ?property .
}
WHERE {
{
$this a sh:NodeShape .
{
{
?descendant rdfs:subClassOf+ $this .
?descendant sh:property/sh:path ?property .
}
UNION
{
$this rdfs:subClassOf+ ?ancestor .
?ancestor sh:property/sh:path ?property .
}
}
}
UNION
{
$this a sh:NodeShape .
BIND(rdf:type AS ?property)
}
}
Try it
owl2sh-closed:closeNodeShapes
rdfs:label
Close NodeShapes
rdfs:comment
Make all sh:NodeShapes closed Shapes
sh:order
10
CONSTRUCT {
$this sh:closed true .
}
WHERE {
$this a sh:NodeShape .
}
Try it
owl2sh-closed:owlAllValuesFrom2shClassOrDatatype
rdfs:label
owl:allValuesFrom with IRI to sh:class or sh:datatype
rdfs:comment
For each owl:allValuesFrom restriction, create a corresponding sh:class or sh:datatype constraint.
sh:order
4
CONSTRUCT {
?propertyShape ?parameter ?allValuesFrom .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:onProperty ?property .
?restriction owl:allValuesFrom ?allValuesFrom .
FILTER isIRI(?allValuesFrom) .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
BIND (
IF(
(?allValuesFrom IN (xsd:boolean, xsd:string, xsd:date, xsd:dateTime, xsd:integer, xsd:float, xsd:duration, xsd:anyURI)),
sh:datatype,
sh:class
)
AS ?parameter
) .
}
Try it
owl2sh-closed:owlFunctionalProperty2shMaxCount1
rdfs:label
owl:FunctionalProperty to sh:maxCount 1
rdfs:comment
For each relevant property that is owl:FunctionalProperty, create sh:maxCount of 1 (unless there is an OWL cardinality restriction).
sh:order
3
CONSTRUCT {
?propertyShape sh:maxCount 1 .
}
WHERE {
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
?property a owl:FunctionalProperty .
FILTER NOT EXISTS {
$this rdfs:subClassOf* ?class .
?class rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
?restriction owl:maxCardinality|owl:cardinality ?any .
}
}
Try it
owl2sh-closed:owlHasValue2shHasValue
rdfs:label
owl:hasValue to sh:hasValue
rdfs:comment
For each owl:hasValue restriction, create a corresponding sh:hasValue constraint.
sh:order
8
CONSTRUCT {
?propertyShape sh:hasValue ?hasValue .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:onProperty ?property .
?restriction owl:hasValue ?hasValue .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:owlMaxCardinality2shMaxCount
rdfs:label
owl:maxCardinality to sh:maxCount
rdfs:comment
For each owl:maxCardinality restriction, create a corresponding sh:maxCount constraint.
sh:order
6
CONSTRUCT {
?propertyShape sh:maxCount ?maxCount .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
?restriction owl:onProperty ?property .
?restriction owl:maxCardinality|owl:cardinality ?raw .
BIND (xsd:integer(?raw) AS ?maxCount) .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:owlMaxQualifiedCardinalityOnClass2shMaxCount
rdfs:label
owl:maxQualifiedCardinality with owl:onClass to sh:maxCount
rdfs:comment
For each owl:maxQualifiedCardinality restriction on an IRI class, create a corresponding sh:maxCount constraint, if the owl:onClass is identical to the rdfs:range of the property.
sh:order
6
PREFIX sh:
PREFIX owl:
PREFIX rdfs:
PREFIX xsd:
PREFIX owl2sh-closed:
CONSTRUCT {
?propertyShape sh:maxCount ?maxCount .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:maxQualifiedCardinality ?raw .
?restriction owl:onProperty ?property .
?restriction owl:onClass ?onClass .
FILTER isIRI(?onClass) .
FILTER EXISTS { ?property rdfs:range ?onClass } .
BIND (xsd:integer(?raw) AS ?maxCount) .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:owlMaxQualifiedCardinalityOnClass2shQualifiedMaxCount
rdfs:label
owl:maxQualifiedCardinality with owl:onClass to sh:qualifiedMaxCount
rdfs:comment
For each owl:maxQualifiedCardinality restriction on an IRI class, create a corresponding (new) sh:qualifiedMaxCount constraint, unless the owl:onClass is identical to the rdfs:range of the property.
sh:order
6
CONSTRUCT {
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
?propertyShape sh:qualifiedMaxCount ?maxCount .
?propertyShape sh:qualifiedValueShape ?valueShape .
?valueShape sh:class ?onClass .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:maxQualifiedCardinality ?raw .
?restriction owl:onProperty ?property .
?restriction owl:onClass ?onClass .
FILTER isIRI(?onClass) .
FILTER NOT EXISTS { ?property rdfs:range ?onClass } .
BIND (xsd:integer(?raw) AS ?maxCount) .
BIND (BNODE() AS ?propertyShape) .
BIND (BNODE() AS ?valueShape) .
}
Try it
owl2sh-closed:owlMaxQualifiedCardinalityOnDataRange2shQualifiedMaxCount
rdfs:label
owl:maxQualifiedCardinality with owl:onDataRange to sh:qualifiedMaxCount
rdfs:comment
For each owl:maxQualifiedCardinality restriction on an IRI datatype, create a corresponding (new) sh:qualifiedMaxCount constraint.
sh:order
6
CONSTRUCT {
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
?propertyShape sh:qualifiedMaxCount ?maxCount .
?propertyShape sh:qualifiedValueShape ?valueShape .
?valueShape sh:datatype ?onDataRange .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:maxQualifiedCardinality ?raw .
?restriction owl:onProperty ?property .
?restriction owl:onDataRange ?onDataRange .
FILTER isIRI(?onDataRange) .
FILTER NOT EXISTS { ?property rdfs:range ?onDataRange } .
BIND (xsd:integer(?raw) AS ?maxCount) .
BIND (BNODE() AS ?propertyShape) .
BIND (BNODE() AS ?valueShape) .
}
Try it
owl2sh-closed:owlMinCardinality2shMinCount
rdfs:label
owl:minCardinality to sh:minCount
rdfs:comment
For each owl:minCardinality restriction, create a corresponding sh:minCount constraint.
sh:order
6
CONSTRUCT {
?propertyShape sh:minCount ?maxCount .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:minCardinality|owl:cardinality ?raw .
?restriction owl:onProperty ?property .
BIND (xsd:integer(?raw) AS ?maxCount) .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:owlMinQualifiedCardinalityOnClass2shMinCount
rdfs:label
owl:minQualifiedCardinality with owl:onClass to sh:minCount
rdfs:comment
For each owl:minQualifiedCardinality restriction on an IRI class, create a corresponding sh:minCount constraint, if the owl:onClass is identical to the rdfs:range of the property.
sh:order
6
CONSTRUCT {
?propertyShape sh:minCount ?minCount .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:minQualifiedCardinality ?raw .
?restriction owl:onClass ?onClass .
?restriction owl:onProperty ?property .
FILTER isIRI(?onClass) .
FILTER EXISTS { ?property rdfs:range ?onClass } .
BIND (xsd:integer(?raw) AS ?minCount) .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:owlMinQualifiedCardinalityOnClass2shQualifiedMinCount
rdfs:label
owl:minQualifiedCardinality with owl:onClass to sh:qualifiedMinCount
rdfs:comment
For each owl:minQualifiedCardinality restriction on an IRI class, create a corresponding (new) sh:qualifiedMinCount constraint, unless the owl:onClass is identical to the rdfs:range of the property.
sh:order
6
CONSTRUCT {
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
?propertyShape sh:qualifiedMinCount ?minCount .
?propertyShape sh:qualifiedValueShape ?valueShape .
?valueShape sh:class ?onClass .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:minQualifiedCardinality ?raw .
?restriction owl:onClass ?onClass .
?restriction owl:onProperty ?property .
FILTER isIRI(?onClass) .
FILTER NOT EXISTS { ?property rdfs:range ?onClass } .
BIND (xsd:integer(?raw) AS ?minCount) .
BIND (BNODE() AS ?propertyShape) .
BIND (BNODE() AS ?valueShape) .
}
Try it
owl2sh-closed:owlMinQualifiedCardinalityOnDataRange2shQualifiedMinCount
rdfs:label
owl:minQualifiedCardinality with owl:onDataRange to sh:qualifiedMinCount
rdfs:comment
For each owl:minQualifiedCardinality restriction on an IRI datatype, create a corresponding (new) sh:qualifiedMinCount constraint.
sh:order
6
CONSTRUCT {
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
?propertyShape sh:qualifiedMinCount ?minCount .
?propertyShape sh:qualifiedValueShape ?valueShape .
?valueShape sh:datatype ?onDataRange .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:minQualifiedCardinality ?raw .
?restriction owl:onDataRange ?onDataRange .
?restriction owl:onProperty ?property .
FILTER isIRI(?onDataRange) .
FILTER NOT EXISTS { ?property rdfs:range ?onDataRange } .
BIND (xsd:integer(?raw) AS ?minCount) .
BIND (BNODE() AS ?propertyShape) .
BIND (BNODE() AS ?valueShape) .
}
Try it
owl2sh-closed:owlQualifiedCardinalityOnClass2shMinMaxCount
rdfs:label
owl:qualifiedCardinality with owl:onClass to sh:max/minCount
rdfs:comment
For each owl:qualifiedCardinality restriction on an IRI class, create corresponding sh:max/minCount constraints, if the owl:onClass is identical to the rdfs:range of the property.
sh:order
6
CONSTRUCT {
?propertyShape sh:maxCount ?count .
?propertyShape sh:minCount ?count .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:qualifiedCardinality ?raw .
?restriction owl:onClass ?onClass .
?restriction owl:onProperty ?property .
FILTER isIRI(?onClass) .
FILTER EXISTS { ?property rdfs:range ?onClass } .
BIND (xsd:integer(?raw) AS ?count) .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:owlQualifiedCardinalityOnClass2shQualifiedMinMaxCount
rdfs:label
owl:qualifiedCardinality with owl:onClass to sh:qualifiedMax/MinCount
rdfs:comment
For each owl:qualifiedCardinality restriction on an IRI class, create a corresponding (new) sh:qualifiedMax/MinCount constraint, unless the owl:onClass is identical to the rdfs:range of the property.
sh:order
6
CONSTRUCT {
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
?propertyShape sh:qualifiedMaxCount ?count .
?propertyShape sh:qualifiedMinCount ?count .
?propertyShape sh:qualifiedValueShape ?valueShape .
?valueShape sh:class ?onClass .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:qualifiedCardinality ?raw .
?restriction owl:onClass ?onClass .
?restriction owl:onProperty ?property .
FILTER isIRI(?onClass) .
FILTER NOT EXISTS { ?property rdfs:range ?onClass } .
BIND (xsd:integer(?raw) AS ?count) .
BIND (BNODE() AS ?propertyShape) .
BIND (BNODE() AS ?valueShape) .
}
Try it
owl2sh-closed:owlQualifiedCardinalityOnDataRange2shQualifiedMinMaxCount
rdfs:label
owl:qualifiedCardinality with owl:onDataRange to sh:qualifiedMax/MinCount
rdfs:comment
For each owl:qualifiedCardinality restriction on an IRI datatype, create a corresponding (new) sh:qualifiedMax/MinCount constraint.
sh:order
6
CONSTRUCT {
$this sh:property ?propertyShape .
?propertyShape sh:path ?property .
?propertyShape sh:qualifiedMaxCount ?count .
?propertyShape sh:qualifiedMinCount ?count .
?propertyShape sh:qualifiedValueShape ?valueShape .
?valueShape sh:datatype ?onDataRange .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:qualifiedCardinality ?raw .
?restriction owl:onDataRange ?onDataRange .
?restriction owl:onProperty ?property .
FILTER isIRI(?onDataRange) .
FILTER NOT EXISTS { ?property rdfs:range ?onDataRange } .
BIND (xsd:integer(?raw) AS ?count) .
BIND (BNODE() AS ?propertyShape) .
BIND (BNODE() AS ?valueShape) .
}
Try it
owl2sh-closed:owlSomeValuesFrom2shMinCount1
rdfs:label
owl:someValuesFrom to sh:minCount 1
rdfs:comment
For each owl:someValuesFrom restriction, create a corresponding sh:minCount 1 constraint.
sh:order
4
CONSTRUCT {
?propertyShape sh:minCount 1 .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
?restriction owl:someValuesFrom ?someValuesFrom .
?restriction owl:onProperty ?property .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:owlSomeValuesFromAllValuesFrom2dashHasValueWithClass
rdfs:label
owl:someValuesFrom with IRI to dash:hasValueWithClass
rdfs:comment
For each owl:someValuesFrom restriction combined with an owl:allValuesFrom on an IRI, create a corresponding dash:hasValueWithClass constraint using a path expression.
For example:
ex:ConstitutionalOwner
a owl:Class ;
rdfs:subClassOf [
a owl:Restriction ;
owl:onProperty ex:isPlayedBy ;
owl:someValuesFrom [
a owl:Restriction ;
owl:allValuesFrom ex:StockholdersEquity ;
owl:onProperty ex:holdsEquityIn ;
] ;
] .
becomes
ex:ConstitutionalOwner
a sh:NodeShape ;
sh:property [
sh:path ( ex:isPlayedBy ex:holdsEquityIn ) ;
dash:hasValueWithClass ex:StockholdersEquity ;
] .
sh:order
7
CONSTRUCT {
$this sh:property ?propertyShape .
?propertyShape dash:hasValueWithClass ?allValuesFrom .
?propertyShape sh:path ?firstNode .
?firstNode rdf:first ?property .
?firstNode rdf:rest ?secondNode .
?secondNode rdf:first ?allValuesFromProperty .
?secondNode rdf:rest rdf:nil .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:someValuesFrom ?someValuesFrom .
?someValuesFrom owl:allValuesFrom ?allValuesFrom .
FILTER isIRI(?allValuesFrom) .
FILTER (!(?allValuesFrom IN (xsd:boolean, xsd:string, xsd:date, xsd:dateTime, xsd:integer, xsd:float, xsd:duration, xsd:anyURI))) .
FILTER isBlank(?someValuesFrom) .
}
?restriction owl:onProperty ?property .
?someValuesFrom owl:onProperty ?allValuesFromProperty .
BIND (BNODE() AS ?propertyShape) .
BIND (BNODE() AS ?firstNode) .
BIND (BNODE() AS ?secondNode) .
}
Try it
owl2sh-closed:owlSomeValuesFromIRI2dashHasValueWithClass
rdfs:label
owl:someValuesFrom with IRI to dash:hasValueWithClass
rdfs:comment
For each owl:someValuesFrom restriction with an IRI, create a corresponding dash:hasValueWithClass constraint.
sh:order
4
CONSTRUCT {
?propertyShape dash:hasValueWithClass ?someValuesFrom .
# ?restriction owl2sh-closed:mappedTo ?propertyShape .
}
WHERE {
{
$this rdfs:subClassOf ?restriction .
?restriction a owl:Restriction .
FILTER isBlank(?restriction) .
}
?restriction owl:someValuesFrom ?someValuesFrom .
?restriction owl:onProperty ?property .
FILTER (isIRI(?someValuesFrom))
FILTER (!(?someValuesFrom IN (xsd:boolean, xsd:string, xsd:date, xsd:dateTime, xsd:integer, xsd:float, xsd:duration, xsd:anyURI))) .
FILTER NOT EXISTS { ?property rdfs:range ?someValuesFrom } .
BIND (owl2sh-closed:getPropertyShape(?property, $this) AS ?propertyShape) .
}
Try it
owl2sh-closed:owlUnionOfIRIs2rdfsSubClassOf
rdfs:label
owl:unionOf IRIs to rdfs:subClassOf
rdfs:comment
For each owl:unionOf that only consists of named classes, move these classes into "normal" rdfs:subClassOf triples.
sh:order
4
CONSTRUCT {
$this rdfs:subClassOf ?class .
# ?union owl2sh-closed:mappedTo $this .
}
WHERE {
{
$this rdfs:subClassOf ?union .
?union owl:unionOf ?unionOf .
FILTER isBlank(?union) .
}
FILTER NOT EXISTS {
?unionOf rdf:rest*/rdf:first ?member .
FILTER (!isIRI(?member)) .
} .
?unionOf rdf:rest*/rdf:first ?class .
}
Try it
owl2sh-closed:rdfsRange2shClassOrDatatype
rdfs:label
rdfs:range with IRI to sh:class or sh:datatype
rdfs:comment
For each relevant property that has an rdfs:range, create sh:class or sh:datatype constraint unless it already exists (from a restriction).
sh:order
5
CONSTRUCT {
?propertyShape ?parameter ?range .
}
WHERE {
{
$this sh:property ?propertyShape .
FILTER NOT EXISTS { ?propertyShape sh:node|sh:class|sh:datatype ?any } .
}
?propertyShape sh:path ?property .
?property rdfs:range ?range .
FILTER isIRI(?range) .
# exclude the case where range is rdfs:Literal, this will be handled with an sh:kind
FILTER(?range != rdfs:Literal) .
# exclude the case where range is owl:Thing
BIND (
IF(
(?range IN (xsd:boolean, xsd:string, xsd:date, xsd:dateTime, xsd:integer, xsd:float, xsd:duration, xsd:anyURI)),
sh:datatype,
sh:class
) AS ?parameter) .
}
Try it
owl2sh-closed:rdfsRange2shNode
rdfs:label
rdfs:range with IRI to sh:class or sh:datatype
rdfs:comment
For each relevant property that has an rdfs:range, creates an sh:node if the range yielded a NodeShape that has an sh:hasValue constraint, instead of an sh:class
sh:order
4
CONSTRUCT {
?propertyShape sh:node ?range .
}
WHERE {
{
$this sh:property ?propertyShape .
}
?propertyShape sh:path ?property .
?property rdfs:range ?range .
?range sh:property ?propertyWithHasValue .
?propertyWithHasValue sh:hasValue ?anything .
}
Try it
owl2sh-closed:rdfsRangeLiteral2shNodeKind
rdfs:label
rdfs:range rdfs:Literal to sh:nodeKind sh:Literal
rdfs:comment
For each relevant property that has an rdfs:range with value rdfs:Literal, create sh:nodeKind constraint.
sh:order
5
CONSTRUCT {
?propertyShape sh:nodeKind sh:Literal .
}
WHERE {
?propertyShape sh:path ?property .
?property a owl:DatatypeProperty .
?property rdfs:range rdfs:Literal .
}
Try it
owl2sh-closed:shPropertyShapeCleanUp
rdfs:label
sh:property shape clean up
rdfs:comment
For each value of sh:property, add a rdf:type sh:PropertyShape triple.
sh:order
100
CONSTRUCT {
?propertyShape a sh:PropertyShape .
}
WHERE {
?shape sh:property ?propertyShape .
}