Commit 38f7d54e authored by vehnem's avatar vehnem
Browse files

api: completeness & logs

parent 24a93d3f
...@@ -22,7 +22,15 @@ libraryDependencies ++= Seq( ...@@ -22,7 +22,15 @@ libraryDependencies ++= Seq(
) )
// https://mvnrepository.com/artifact/org.apache.jena/jena-arq // https://mvnrepository.com/artifact/org.apache.jena/jena-arq
libraryDependencies += "org.apache.jena" % "jena-arq" % "3.15.0" libraryDependencies += "org.apache.jena" % "jena-arq" % "3.13.0"
//val AkkaVersion = "2.5.31"
//
//libraryDependencies ++= Seq(
// "com.lightbend.akka" %% "akka-stream-alpakka-ftp" % "2.0.1",
// "com.typesafe.akka" %% "akka-stream" % AkkaVersion
//)
enablePlugins(SbtTwirl) enablePlugins(SbtTwirl)
enablePlugins(ScalatraPlugin) enablePlugins(ScalatraPlugin)
package org.dbpedia.release
/**
* Dashboard config
*/
object Config {
}
package org.dbpedia.release package org.dbpedia.release
import org.apache.jena.query.{QueryException, QueryExecutionFactory} import org.apache.jena.query.{QueryException, QueryExecutionFactory}
import org.dbpedia.release.handler.{CompletenessHandler, ReleaseLogHandler}
import org.json4s.{DefaultFormats, Formats} import org.json4s.{DefaultFormats, Formats}
import org.scalatra._ import org.scalatra._
import org.scalatra.json.JacksonJsonSupport import org.scalatra.json.JacksonJsonSupport
...@@ -31,6 +32,35 @@ class DataApiServlet(implicit val swagger: Swagger) ...@@ -31,6 +32,35 @@ class DataApiServlet(implicit val swagger: Swagger)
protected implicit val jsonFormats: Formats = DefaultFormats protected implicit val jsonFormats: Formats = DefaultFormats
get("/release/versions") {
}
get("/release/logs/:group/:version") {
val group = params("group")
val version = params("version").replace(".","-")
ReleaseLogHandler.getLogFiles(group,version) match {
case Some(array) => array.toList
case _ => List
}
}
get("/release/downloads/:group/:version") {
val group = params("group")
val version = params("version")
}
get("/release/completeness/:group/:version") {
val group = params("group")
val version = params("version")
CompletenessHandler.getStatus(group,version)
}
private val getVersions = private val getVersions =
apiOperation[VersionResponse]("versionsByGroup") apiOperation[VersionResponse]("versionsByGroup")
.summary("Show all versions") .summary("Show all versions")
...@@ -54,8 +84,7 @@ class DataApiServlet(implicit val swagger: Swagger) ...@@ -54,8 +84,7 @@ class DataApiServlet(implicit val swagger: Swagger)
.sparqlService( .sparqlService(
"http://databus.dbpedia.org/repo/sparql", "http://databus.dbpedia.org/repo/sparql",
Queries.versionQuery(group) Queries.versionQuery(group)
) ).execSelect()
.execSelect()
.forEachRemaining(row => { .forEachRemaining(row => {
val version = row.get("?version").asLiteral().getLexicalForm val version = row.get("?version").asLiteral().getLexicalForm
val account = row.get("account").asResource().getURI val account = row.get("account").asResource().getURI
......
[ [
{ {
"version": "<a class=\"text-danger\" href=\"/2020.06.01\">2020.06.01</a> M|G|W" "version": "<a class=\"text-danger\" href=\"?version=2020.06.01#version\">2020.06.01</a> M|G|W"
}, },
{ {
"version": "<a class=\"text-warning\" href=\"/2020.05.01\">2020.05.01</a>" "version": "<a class=\"text-warning\" href=\"/2020.05.01\">2020.05.01</a>"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.16.0/dist/bootstrap-table.min.css"> <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.16.0/dist/bootstrap-table.min.css">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment