Skip to content

Commit

Permalink
Publish metadata also in the Jelly format (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostrzyciel authored Sep 22, 2023
1 parent b221f4c commit 5584aa7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions src/main/scala/commands/DatasetDocGenCommand.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)}
| <br>Source repository: **[${mi.identifier}]($baseRepoUrl/dataset-${mi.identifier})**
|
|""".stripMargin
Expand Down
5 changes: 2 additions & 3 deletions src/main/scala/commands/MainDocGenCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion src/main/scala/commands/SchemaDocGenCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"""
Expand Down
5 changes: 5 additions & 0 deletions src/main/scala/util/Constants.scala
Original file line number Diff line number Diff line change
@@ -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](
Expand Down
4 changes: 4 additions & 0 deletions src/main/scala/util/doc/MarkdownUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)**"

0 comments on commit 5584aa7

Please sign in to comment.