Skip to content

Commit

Permalink
Merge pull request #506 from ulitol97/master
Browse files Browse the repository at this point in the history
Updated Shex-s version
  • Loading branch information
ulitol97 authored Apr 4, 2022
2 parents 67088d2 + ec64c67 commit 1627a93
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 4,829 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.class
*.log
.bloop
.bsp
.bsp/*
.bloop/*

# sbt specific
Expand Down
165 changes: 86 additions & 79 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,81 @@ lazy val scala213 = "2.13.8"
lazy val scala3 = "3.1.1"

lazy val supportedScalaVersions = List(
scala3, scala212, scala213
scala3,
scala212,
scala213
)

val Java11 = JavaSpec.temurin("11") // "[email protected]"


// Local dependencies
lazy val srdfVersion = "0.1.106"
lazy val utilsVersion = "0.2.4"
lazy val shexVersion = "0.2.0"
lazy val shaclVersion = "0.1.78"
lazy val srdfVersion = "0.1.107"
lazy val utilsVersion = "0.2.4"
lazy val shexVersion = "0.2.1"
lazy val shaclVersion = "0.1.78"

// Dependency versions
lazy val catsVersion = "2.7.0"
lazy val circeVersion = "0.14.1"
lazy val jenaVersion = "4.3.2"
lazy val jgraphtVersion = "1.3.1"
lazy val jlineVersion = "3.17.0"
lazy val jnaVersion = "5.6.0"
lazy val logbackVersion = "1.2.3"
lazy val loggingVersion = "3.9.4"
lazy val munitVersion = "0.7.29"
lazy val munitEffectVersion = "1.0.7"
lazy val pprintVersion = "0.7.1"
lazy val rdf4jVersion = "3.0.0"
lazy val scalacheckVersion = "1.15.4"
lazy val scallopVersion = "4.1.0"
lazy val shaclTQVersion = "1.3.2"
lazy val typesafeConfigVersion = "1.4.1"

lazy val catsVersion = "2.7.0"
lazy val circeVersion = "0.14.1"
lazy val jenaVersion = "4.4.0"
lazy val jgraphtVersion = "1.3.1"
lazy val jlineVersion = "3.21.0"
lazy val jnaVersion = "5.11.0"
lazy val logbackVersion = "1.2.11"
lazy val loggingVersion = "3.9.4"
lazy val munitVersion = "0.7.29"
lazy val munitEffectVersion = "1.0.7"
lazy val pprintVersion = "0.7.3"
lazy val rdf4jVersion = "3.7.6"
lazy val scalacheckVersion = "1.15.4"
lazy val scallopVersion = "4.1.0"
lazy val shaclTQVersion = "1.4.0"
lazy val typesafeConfigVersion = "1.4.2"

// Compiler plugin dependency versions
lazy val simulacrumVersion = "1.0.0"
// lazy val kindProjectorVersion = "0.9.5"
// lazy val scalaMacrosVersion = "2.1.1"


// WESO components
lazy val srdf = "es.weso" %% "srdf" % srdfVersion
lazy val srdfJena = "es.weso" %% "srdfjena" % srdfVersion
lazy val srdf4j = "es.weso" %% "srdf4j" % srdfVersion
lazy val utils = "es.weso" %% "utils" % utilsVersion
lazy val typing = "es.weso" %% "typing" % utilsVersion
lazy val srdf = "es.weso" %% "srdf" % srdfVersion
lazy val srdfJena = "es.weso" %% "srdfjena" % srdfVersion
lazy val srdf4j = "es.weso" %% "srdf4j" % srdfVersion
lazy val utils = "es.weso" %% "utils" % utilsVersion
lazy val typing = "es.weso" %% "typing" % utilsVersion
lazy val validating = "es.weso" %% "validating" % utilsVersion
lazy val utilsTest = "es.weso" %% "utilstest" % utilsVersion
lazy val shex = "es.weso" %% "shex" % shexVersion
lazy val shexTest = "es.weso" %% "shextest" % shexVersion
lazy val shapemap = "es.weso" %% "shapemap" % shexVersion
lazy val shacl = "es.weso" %% "shacl" % shaclVersion
lazy val utilsTest = "es.weso" %% "utilstest" % utilsVersion
lazy val shex = "es.weso" %% "shex" % shexVersion
lazy val shexTest = "es.weso" %% "shextest" % shexVersion
lazy val shapemap = "es.weso" %% "shapemap" % shexVersion
lazy val shacl = "es.weso" %% "shacl" % shaclVersion

// Other dependency modules
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
lazy val catsKernel = "org.typelevel" %% "cats-kernel" % catsVersion
lazy val circeCore = "io.circe" %% "circe-core" % circeVersion
lazy val circeGeneric = "io.circe" %% "circe-generic" % circeVersion
lazy val circeParser = "io.circe" %% "circe-parser" % circeVersion
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
lazy val catsKernel = "org.typelevel" %% "cats-kernel" % catsVersion
lazy val circeCore = "io.circe" %% "circe-core" % circeVersion
lazy val circeGeneric = "io.circe" %% "circe-generic" % circeVersion
lazy val circeParser = "io.circe" %% "circe-parser" % circeVersion
lazy val logbackClassic = "ch.qos.logback" % "logback-classic" % logbackVersion
lazy val jenaArq = "org.apache.jena" % "jena-arq" % jenaVersion
lazy val jenaShacl = "org.apache.jena" % "jena-shacl" % jenaVersion
lazy val jenaShEx = "org.apache.jena" % "jena-shex" % jenaVersion
lazy val jenaFuseki = "org.apache.jena" % "jena-fuseki-main" % jenaVersion
lazy val jline = "org.jline" % "jline" % jlineVersion
lazy val jna = "net.java.dev.jna" % "jna" % jnaVersion
lazy val munit = "org.scalameta" %% "munit" % munitVersion
lazy val munitEffect = "org.typelevel" %% "munit-cats-effect-3" % munitEffectVersion
lazy val jenaArq = "org.apache.jena" % "jena-arq" % jenaVersion
lazy val jenaShacl = "org.apache.jena" % "jena-shacl" % jenaVersion
lazy val jenaShEx = "org.apache.jena" % "jena-shex" % jenaVersion
lazy val jenaFuseki = "org.apache.jena" % "jena-fuseki-main" % jenaVersion
lazy val jline = "org.jline" % "jline" % jlineVersion
lazy val jna = "net.java.dev.jna" % "jna" % jnaVersion
lazy val munit = "org.scalameta" %% "munit" % munitVersion
lazy val munitEffect = "org.typelevel" %% "munit-cats-effect-3" % munitEffectVersion
lazy val MUnitFramework = new TestFramework("munit.Framework")

lazy val pprint = "com.lihaoyi" %% "pprint" % pprintVersion
lazy val rdf4j_runtime = "org.eclipse.rdf4j" % "rdf4j-runtime" % rdf4jVersion
lazy val shaclTQ = "org.topbraid" % "shacl" % shaclTQVersion
lazy val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % loggingVersion
lazy val scallop = "org.rogach" %% "scallop" % scallopVersion
lazy val typesafeConfig = "com.typesafe" % "config" % typesafeConfigVersion
lazy val pprint = "com.lihaoyi" %% "pprint" % pprintVersion
lazy val rdf4j_runtime = "org.eclipse.rdf4j" % "rdf4j-runtime" % rdf4jVersion
lazy val shaclTQ = "org.topbraid" % "shacl" % shaclTQVersion
lazy val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % loggingVersion
lazy val scallop = "org.rogach" %% "scallop" % scallopVersion
lazy val typesafeConfig = "com.typesafe" % "config" % typesafeConfigVersion

ThisBuild / githubWorkflowJavaVersions := Seq(Java11)


lazy val shaclex = project
.in(file("."))
.enablePlugins(
Expand All @@ -89,7 +87,8 @@ lazy val shaclex = project
// SbtNativePackager,
WindowsPlugin,
JavaAppPackaging,
LauncherJarPlugin)
LauncherJarPlugin
)
// .disablePlugins(RevolverPlugin)
// .settings(
// buildInfoKeys := BuildInfoKey.ofN(name, version, scalaVersion, sbtVersion),
Expand Down Expand Up @@ -118,7 +117,7 @@ lazy val shaclex = project
Global / cancelable := true,
fork := true,
// parallelExecution in Test := false,
ThisBuild / turbo := true,
ThisBuild / turbo := true
// skip in publish := true
)

Expand All @@ -127,7 +126,8 @@ lazy val schemaInfer = project
// .disablePlugins(RevolverPlugin)
.settings(
crossScalaVersions := supportedScalaVersions,
commonSettings, publishSettings,
commonSettings,
publishSettings,
libraryDependencies ++= Seq(srdf)
)
.dependsOn(
Expand All @@ -138,7 +138,8 @@ lazy val schema = project
.in(file("modules/schema"))
.settings(
crossScalaVersions := supportedScalaVersions,
commonSettings, publishSettings,
commonSettings,
publishSettings,
libraryDependencies ++= Seq(
scalaLogging,
srdf,
Expand All @@ -164,7 +165,7 @@ lazy val slang = project
// .disablePlugins(RevolverPlugin)
.settings(commonSettings, publishSettings)
.dependsOn(
)
)
.settings(
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= Seq(
Expand All @@ -176,8 +177,8 @@ lazy val slang = project
shacl,
utils,
srdf,
srdf4j % Test,
srdfJena % Test,
srdf4j % Test,
srdfJena % Test
)
)

Expand All @@ -186,7 +187,8 @@ lazy val sgraph = project
// .disablePlugins(RevolverPlugin)
.settings(
crossScalaVersions := supportedScalaVersions,
commonSettings, publishSettings,
commonSettings,
publishSettings,
libraryDependencies ++= Seq(
scalaLogging,
utils,
Expand All @@ -195,9 +197,9 @@ lazy val sgraph = project
catsCore,
catsKernel,
// catsMacros,
srdf4j % Test,
srdfJena % Test,
munit % Test,
srdf4j % Test,
srdfJena % Test,
munit % Test,
munitEffect % Test
),
testFrameworks += MUnitFramework
Expand All @@ -208,7 +210,8 @@ lazy val converter = project
// .disablePlugins(RevolverPlugin)
.settings(
crossScalaVersions := supportedScalaVersions,
commonSettings, publishSettings,
commonSettings,
publishSettings,
libraryDependencies ++= Seq(
scalaLogging,
logbackClassic,
Expand All @@ -217,7 +220,7 @@ lazy val converter = project
shex,
shacl,
pprint,
munit % Test,
munit % Test,
munitEffect % Test
),
testFrameworks += MUnitFramework
Expand All @@ -240,10 +243,11 @@ lazy val packagingSettings = Seq(
// Do not package logback files in .jar, they interfere with other logback
// files in classpath
Compile / packageBin / mappings ~= { project =>
project.filter { case (file, _) =>
val fileName = file.getName
!(fileName.startsWith("logback") && (fileName.endsWith(".xml") || fileName
.endsWith(".groovy")))
project.filter {
case (file, _) =>
val fileName = file.getName
!(fileName.startsWith("logback") && (fileName.endsWith(".xml") || fileName
.endsWith(".groovy")))
}
},
Compile / mainClass := Some("es.weso.shaclex.Main"),
Expand All @@ -269,7 +273,7 @@ lazy val compilationSettings = Seq(
"-Yrangepos",
"-Ywarn-dead-code", // Warn when dead code is identified.
// "-Xfatal-warnings",
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-extra-implicit" // Warn when more than one implicit parameter section is defined.
)
// format: on
)
Expand All @@ -293,6 +297,7 @@ lazy val commonSettings = compilationSettings ++ sharedDependencies ++ Seq(
)
)

//noinspection HttpUrlsUsage
lazy val publishSettings = Seq(
// maintainer := "Jose Emilio Labra Gayo <[email protected]>",
homepage := Some(url("https://github.com/weso/shaclex")),
Expand All @@ -308,17 +313,19 @@ lazy val publishSettings = Seq(
</developer>
</developers>, */
publishMavenStyle := true,
sonatypeProfileName := ("es.weso"),
sonatypeProfileName := "es.weso",
homepage := Some(url("https://github.com/weso/shaclex")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
scmInfo := Some(ScmInfo(url("https://github.com/weso/shaclex"), "scm:git:[email protected]:weso/shaclex.git")),
autoAPIMappings := true,
apiURL := Some(url("http://weso.github.io/shaclex/latest/api/")),
autoAPIMappings := true,
developers := List(Developer(
id = "labra",
name = "Jose Emilio Labra Gayo",
email = "[email protected]",
url = url("https://labra.weso.es")
))
developers := List(
Developer(
id = "labra",
name = "Jose Emilio Labra Gayo",
email = "[email protected]",
url = url("https://labra.weso.es")
)
)
)
20 changes: 9 additions & 11 deletions modules/schema/src/main/scala/es/weso/schema/Result.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ import cats.Show
import com.typesafe.scalalogging.LazyLogging
// import es.weso.rdf.{PrefixMap, RDFReader}
import es.weso.rdf.nodes.{IRI, RDFNode}
import es.weso.shapemaps._
import io.circe._
import io.circe.generic.auto._
import io.circe.syntax._
import es.weso.shapemaps._
// import es.weso.rdf.jena.RDFAsJenaModel
import java.io._
// import es.weso.shacl.report.ValidationReport
import es.weso.rdf.RDFBuilder
import cats.effect._
import es.weso.rdf.PrefixMap
import es.weso.rdf.{PrefixMap, RDFBuilder}

sealed abstract trait DetailsOption extends Product with Serializable
sealed trait DetailsOption extends Product with Serializable
case object Details extends DetailsOption
case object NoDetails extends DetailsOption

Expand All @@ -32,7 +30,7 @@ case class Result(
) extends LazyLogging {

def noSolutions(shapeMaps: Seq[ResultShapeMap]): Boolean = {
shapeMaps.size == 0 || shapeMaps.head.noSolutions
shapeMaps.isEmpty || shapeMaps.head.noSolutions
}

def solution: Either[String, ResultShapeMap] = {
Expand All @@ -54,7 +52,7 @@ case class Result(
def show(base: Option[IRI], details: DetailsOption): String = {
val sb = new StringBuilder
if (isValid) {
if (shapeMaps.size == 0) {
if (shapeMaps.isEmpty) {
sb ++= s"No solutions"
} else {
for ((solution, n) <- shapeMaps zip (1 to cut)) {
Expand Down Expand Up @@ -134,7 +132,7 @@ case class Result(
}

object Result extends LazyLogging {
def empty =
def empty: Result =
Result(
isValid = true,
message = "",
Expand All @@ -145,7 +143,7 @@ object Result extends LazyLogging {
PrefixMap.empty,
PrefixMap.empty)

def errStr(str: String) =
def errStr(str: String): Result =
empty.copy(isValid = false, message = str)

implicit val showResult: Show[Result] = new Show[Result] {
Expand All @@ -156,8 +154,8 @@ object Result extends LazyLogging {
lazy val JSON = "JSON"
lazy val DETAILS = "DETAILS"

lazy val availableResultFormats = List(TEXT, JSON, DETAILS).map(_.toUpperCase)
lazy val defaultResultFormat = availableResultFormats.head
lazy val availableResultFormats: List[String] = List(TEXT, JSON, DETAILS).map(_.toUpperCase)
lazy val defaultResultFormat: String = availableResultFormats.head

// TODO: implement this
implicit val decodeTrigger: Decoder[Option[ValidationTrigger]] = Decoder.instance { c =>
Expand Down
Loading

0 comments on commit 1627a93

Please sign in to comment.