Skip to content

Commit

Permalink
Updated Shex-s
Browse files Browse the repository at this point in the history
  • Loading branch information
ulitol97 committed Apr 5, 2022
1 parent 1627a93 commit 821b7eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ val Java11 = JavaSpec.temurin("11") // "[email protected]"
// Local dependencies
lazy val srdfVersion = "0.1.107"
lazy val utilsVersion = "0.2.4"
lazy val shexVersion = "0.2.1"
lazy val shexVersion = "0.2.2"
lazy val shaclVersion = "0.1.78"

// Dependency versions
Expand Down
39 changes: 21 additions & 18 deletions modules/schema/src/main/scala/es/weso/schema/ShExSchema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import scala.util._
import scala.util.control.NoStackTrace

case class ShExSchema(schema: SchemaShEx)
extends es.weso.schema.Schema
extends es.weso.schema.Schema
with LazyLogging
with SLang2Clingo
with ShEx2SLang {
Expand Down Expand Up @@ -82,10 +82,10 @@ case class ShExSchema(schema: SchemaShEx)
schema.prefixMap
)
case Right(resultShapeMap) =>
val valid = resultShapeMap.isAllConformant
val allValid = resultShapeMap.isAllConformant
Result(
isValid = valid,
if (!valid) "Validated" else "Validated with errors",
isValid = allValid,
if (allValid) "Validated" else "Validated with errors",
shapeMaps = Seq(resultShapeMap),
validationReport = EmptyReport,
errors = resultShapeMap.getAllErrors.map(ErrorInfo(_)),
Expand Down Expand Up @@ -139,16 +139,19 @@ case class ShExSchema(schema: SchemaShEx)
case Right(result) =>
for {
resultShapeMap <- result.toResultShapeMap
} yield Result(
isValid = resultShapeMap.isAllConformant,
if (resultShapeMap.isAllConformant) "Validated" else "Validated with errors",
Seq(resultShapeMap),
EmptyReport,
Seq(),
None,
pm,
schema.prefixMap
)
} yield {
val allValid = resultShapeMap.isAllConformant
Result(
isValid = allValid,
message = if (allValid) "Validated" else "Validated with errors",
shapeMaps = Seq(resultShapeMap),
validationReport = EmptyReport,
errors = resultShapeMap.getAllErrors.map(ErrorInfo(_)),
trigger = None,
nodesPrefixMap = pm,
shapesPrefixMap = schema.prefixMap
)
}
}
} yield res

Expand Down Expand Up @@ -200,10 +203,10 @@ case class ShExSchema(schema: SchemaShEx)
override def pm: PrefixMap = schema.prefixMap

override def convert(
targetFormat: Option[String],
targetEngine: Option[String],
base: Option[IRI]
): IO[String] = {
targetFormat: Option[String],
targetEngine: Option[String],
base: Option[IRI]
): IO[String] = {
targetEngine.map(_.toUpperCase) match {
case None => serialize(targetFormat.getOrElse(DataFormats.defaultFormatName), base)
case Some(engine) if (engine.equalsIgnoreCase(name)) => {
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ThisBuild / version := "0.2.1"
ThisBuild / version := "0.2.2"

0 comments on commit 821b7eb

Please sign in to comment.