Skip to content

Commit

Permalink
feat: Enable rdfs inferencing in shacl validator (DEV-4220) (#3388)
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone authored Oct 15, 2024
1 parent 0459c60 commit a248973
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final case class ShaclValidator() { self =>
} yield report

private def readModel(data: InputStream) = ZIO.attempt {
val model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM)
val model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RDFS_INF)
model.read(data, null, FileUtils.langTurtle)
model
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,18 @@ object ShaclValidatorSpec extends ZIOSpecDefault {
reportResource <- shaclValidator(_.validate(validData, shapes, ValidationOptions.default))
} yield assertTrue(reportResource.hasProperty(SH.conforms, JenaDatatypes.TRUE))
},
test("should do basic rdfs inferencing") {
val data = """
|@prefix ex: <http://example.org/ns#> .
|@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|ex:myProperty
| a rdf:Property.
|""".stripMargin
for {
reportResource <- shaclValidator(_.validate(data, "", ValidationOptions.default))
} yield assertTrue(reportResource.hasProperty(SH.conforms, JenaDatatypes.TRUE))
},
).provide(ShaclValidator.layer)
}

0 comments on commit a248973

Please sign in to comment.