diff --git a/build.sbt b/build.sbt index c294190..71f2122 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ resolvers += "Sonatype OSS Snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots" lazy val circeV = "0.14.5" -lazy val jellyV = "0.2.0+2-d3c7217e-SNAPSHOT" +lazy val jellyV = "0.2.1+2-d27c7618-SNAPSHOT" lazy val jenaV = "4.7.0" lazy val pekkoV = "1.0.1" lazy val pekkoHttpV = "1.0.0" diff --git a/src/main/scala/commands/DatasetDocGenCommand.scala b/src/main/scala/commands/DatasetDocGenCommand.scala index 9841433..a9498db 100644 --- a/src/main/scala/commands/DatasetDocGenCommand.scala +++ b/src/main/scala/commands/DatasetDocGenCommand.scala @@ -1,7 +1,7 @@ package io.github.riverbench.ci_worker package commands -import util.doc.DocBuilder +import util.doc.{DocBuilder, MarkdownUtil} import util.{MetadataInfo, MetadataReader, RdfIoUtil, RdfUtil} import org.apache.jena.rdf.model.Property @@ -139,12 +139,11 @@ object DatasetDocGenCommand extends Command: |""".stripMargin private def indexIntro(mi: MetadataInfo, websiteLink: String): String = - val rdfLinks = f"**[Turtle]($websiteLink.ttl)**, **[N-Triples]($websiteLink.nt)**, **[RDF/XML]($websiteLink.rdf)**" f""" | |!!! info | - | Download this metadata in RDF: $rdfLinks + | Download this metadata in RDF: ${MarkdownUtil.formatMetadataLinks(websiteLink)} |
Source repository: **[${mi.identifier}]($baseRepoUrl/dataset-${mi.identifier})** | |""".stripMargin diff --git a/src/main/scala/commands/MainDocGenCommand.scala b/src/main/scala/commands/MainDocGenCommand.scala index 5cfebf6..39160bb 100644 --- a/src/main/scala/commands/MainDocGenCommand.scala +++ b/src/main/scala/commands/MainDocGenCommand.scala @@ -2,7 +2,7 @@ package io.github.riverbench.ci_worker package commands import util.{AppConfig, ProfileCollection, RdfIoUtil, RdfUtil} -import util.doc.DocBuilder +import util.doc.{DocBuilder, MarkdownUtil} import org.apache.jena.rdf.model.Model import org.apache.jena.riot.RDFDataMgr @@ -167,11 +167,10 @@ object MainDocGenCommand extends Command: |""".stripMargin.strip private def rdfInfo(baseLink: String): String = - val rdfLinks = f"**[Turtle]($baseLink.ttl)**, **[N-Triples]($baseLink.nt)**, **[RDF/XML]($baseLink.rdf)**" f""" | |!!! info | - | Download this metadata in RDF: $rdfLinks + | Download this metadata in RDF: ${MarkdownUtil.formatMetadataLinks(baseLink)} | |""".stripMargin diff --git a/src/main/scala/commands/SchemaDocGenCommand.scala b/src/main/scala/commands/SchemaDocGenCommand.scala index 22e29ba..86824b9 100644 --- a/src/main/scala/commands/SchemaDocGenCommand.scala +++ b/src/main/scala/commands/SchemaDocGenCommand.scala @@ -3,6 +3,7 @@ package commands import util.AppConfig +import io.github.riverbench.ci_worker.util.doc.MarkdownUtil import org.apache.jena.rdf.model.Model import org.apache.jena.riot.RDFDataMgr @@ -106,7 +107,7 @@ object SchemaDocGenCommand extends Command: }) val baseLink = s"${AppConfig.CiWorker.rbRootUrl}schema/$name/$version" - val rdfLinks = f"**[Turtle]($baseLink.ttl)**, **[N-Triples]($baseLink.nt)**, **[RDF/XML]($baseLink.rdf)**" + val rdfLinks = MarkdownUtil.formatMetadataLinks(baseLink) c = rxRdfLinks.replaceAllIn(c, m => { val schemaType = m.group(1).toLowerCase f""" diff --git a/src/main/scala/util/Constants.scala b/src/main/scala/util/Constants.scala index 22555b9..cef15c9 100644 --- a/src/main/scala/util/Constants.scala +++ b/src/main/scala/util/Constants.scala @@ -1,13 +1,18 @@ package io.github.riverbench.ci_worker package util +import eu.ostrzyciel.jelly.convert.jena.riot.{JellyFormat, JellyLanguage} import org.apache.jena.riot.RDFFormat object Constants: + // Register Jelly language in Apache Jena + JellyLanguage.register() + val outputFormats = Seq( ("ttl", RDFFormat.TURTLE_PRETTY), ("rdf", RDFFormat.RDFXML_PRETTY), ("nt", RDFFormat.NTRIPLES_UTF8), + ("jelly", JellyFormat.JELLY_SMALL_STRICT), ) val packageSizes = Seq[Long]( diff --git a/src/main/scala/util/doc/MarkdownUtil.scala b/src/main/scala/util/doc/MarkdownUtil.scala index 0f36ca6..fc22889 100644 --- a/src/main/scala/util/doc/MarkdownUtil.scala +++ b/src/main/scala/util/doc/MarkdownUtil.scala @@ -35,3 +35,7 @@ object MarkdownUtil: val (level, d) = inner(v.toDouble) f"$d%.2f ${sizePrefixes(level)}" + + def formatMetadataLinks(baseUrl: String): String = + f"**[Turtle]($baseUrl.ttl)**, **[N-Triples]($baseUrl.nt)**, " + + f"**[RDF/XML]($baseUrl.rdf)**, **[Jelly]($baseUrl.jelly)**"