From 821b7eb5f6755ee8e07cb914a8ffc9c254d73917 Mon Sep 17 00:00:00 2001 From: ulitol97 Date: Tue, 5 Apr 2022 14:25:26 +0200 Subject: [PATCH] Updated Shex-s --- build.sbt | 2 +- .../scala/es/weso/schema/ShExSchema.scala | 39 ++++++++++--------- version.sbt | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/build.sbt b/build.sbt index 10ed93bf..f7908c2b 100644 --- a/build.sbt +++ b/build.sbt @@ -13,7 +13,7 @@ val Java11 = JavaSpec.temurin("11") // "adopt@1.11" // 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 diff --git a/modules/schema/src/main/scala/es/weso/schema/ShExSchema.scala b/modules/schema/src/main/scala/es/weso/schema/ShExSchema.scala index 0a582973..2160bb2b 100644 --- a/modules/schema/src/main/scala/es/weso/schema/ShExSchema.scala +++ b/modules/schema/src/main/scala/es/weso/schema/ShExSchema.scala @@ -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 { @@ -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(_)), @@ -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 @@ -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)) => { diff --git a/version.sbt b/version.sbt index 63fede42..58202d4e 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -ThisBuild / version := "0.2.1" \ No newline at end of file +ThisBuild / version := "0.2.2" \ No newline at end of file