GitHub PullRequestReviewCommentEvent at 2014-05-25 06:28:24
Repository: banana-rdf
Actor: bblfish
Payload: {"comment":{"url":"https://api.github.com/repos/w3c/banana-rdf/pulls/comments/13029417","id":13029417,"diff_hunk":"@@ -0,0 +1,53 @@\n+package org.w3.banana.plantain\n+\n+import org.w3.banana._\n+import java.io.InputStream\n+import scala.util.Try\n+import spray.http.Uri\n+import org.openrdf.rio._\n+import org.openrdf.rio.turtle._\n+import org.openrdf.{ model => sesame }\n+\n+object PlantainTurtleReader extends RDFReader[Plantain, Turtle] {\n+\n+  val syntax: Syntax[Turtle] = Syntax.Turtle\n+\n+  class Sink(var graph: model.Graph = model.Graph.empty, var prefixes: Map[String, String] = Map.empty) extends RDFHandler {\n+\n+    def startRDF(): Unit = ()\n+    def endRDF(): Unit = ()\n+    def handleComment(comment: String): Unit = ()\n+    def handleNamespace(prefix: String, uri: String): Unit = prefixes += (prefix -> uri)\n+    def handleStatement(statement: org.openrdf.model.Statement): Unit = {\n+      val s: model.Node = statement.getSubject match {\n+        case bnode: sesame.BNode => model.BNode(bnode.getID)\n+        case uri: sesame.URI => model.URI(uri.toString)\n+      }\n+      val p: model.URI = statement.getPredicate match {\n+        case uri: sesame.URI => model.URI(uri.toString)\n+      }\n+      val o: model.Node = statement.getObject match {\n+        case bnode: sesame.BNode => model.BNode(bnode.getID)\n+        case uri: sesame.URI => model.URI(uri.toString)\n+        case literal: sesame.Literal => model.Literal(literal.stringValue, model.URI(literal.getDatatype.stringValue), Option(literal.getLanguage))\n+      }\n+      this.graph = this.graph + (s, p, o)\n+    }\n+\n+  }\n+\n+\n+  def read(is: InputStream, base: String): Try[Plantain#Graph] = Try {\n+    val sink = new Sink\n+    val parser = new TurtleParser\n+    parser.setRDFHandler(sink)\n+    parser.parse(is, base)\n+    sink.graph\n+  }\n+\n+  def main(args: Array[String]): Unit = {\n+    val is = new java.io.FileInputStream(\"/home/betehess/projects/banana-rdf/rdf-test-suite/src/main/resources/card.ttl\")","path":"plantain/src/main/scala/PlantainRDFReader.scala","position":49,"original_position":49,"commit_id":"7a5019b6f707758299a864c9e4207cc0b7f5a832","original_commit_id":"7a5019b6f707758299a864c9e4207cc0b7f5a832","user":{"login":"bblfish","id":124506,"avatar_url":"https://avatars.githubusercontent.com/u/124506?","gravatar_id":"5d537347eb54566c1b9d975a30fc0147","url":"https://api.github.com/users/bblfish","html_url":"https://github.com/bblfish","followers_url":"https://api.github.com/users/bblfish/followers","following_url":"https://api.github.com/users/bblfish/following{/other_user}","gists_url":"https://api.github.com/users/bblfish/gists{/gist_id}","starred_url":"https://api.github.com/users/bblfish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bblfish/subscriptions","organizations_url":"https://api.github.com/users/bblfish/orgs","repos_url":"https://api.github.com/users/bblfish/repos","events_url":"https://api.github.com/users/bblfish/events{/privacy}","received_events_url":"https://api.github.com/users/bblfish/received_events","type":"User","site_admin":false},"body":"hardcoded URI!","created_at":"2014-05-25T06:28:24Z","updated_at":"2014-05-25T06:28:24Z","html_url":"https://github.com/w3c/banana-rdf/pull/102#discussion_r13029417","pull_request_url":"https://api.github.com/repos/w3c/banana-rdf/pulls/102","_links":{"self":{"href":"https://api.github.com/repos/w3c/banana-rdf/pulls/comments/13029417"},"html":{"href":"https://github.com/w3c/banana-rdf/pull/102#discussion_r13029417"},"pull_request":{"href":"https://api.github.com/repos/w3c/banana-rdf/pulls/102"}}}}