Skip to content

Commit

Permalink
Merge pull request #9 from Vehnem/master
Browse files Browse the repository at this point in the history
rdf-detector fix
  • Loading branch information
Vehnem authored Aug 27, 2021
2 parents c65b633 + bf1be68 commit 627a126
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 53 deletions.
35 changes: 29 additions & 6 deletions databus-mods-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
</repositories>

<dependencies>
<dependency>
<groupId>com.github.Vehnem</groupId>
<artifactId>rdfdetector</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.Vehnem</groupId>-->
<!-- <artifactId>rdfdetector</artifactId>-->
<!-- <version>master-SNAPSHOT</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/org.apache.jena/jena-shacl -->
<dependency>
<groupId>org.apache.jena</groupId>
Expand Down Expand Up @@ -59,9 +59,32 @@
<groupId>com.github.jsonld-java</groupId>
<artifactId>jsonld-java</artifactId>
</exclusion>
</exclusions>
</exclusions>
</dependency>
<!-- &lt;!&ndash; https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>javax.persistence</groupId>-->
<!-- <artifactId>javax.persistence-api</artifactId>-->
<!-- <version>2.2</version>-->
<!-- </dependency>-->

<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
<!-- <version>2.3.0.RELEASE</version>-->
<!-- </dependency>-->

<!-- <dependency>-->
<!-- <groupId>org.apache.derby</groupId>-->
<!-- <artifactId>derby</artifactId>-->
<!-- <version>10.14.2.0</version>-->
<!-- </dependency>-->

<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli-spring-boot-starter</artifactId>
<version>4.6.1</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
package org.dbpedia.databus_mods.lib.util

import java.io.BufferedInputStream
import java.net.URL

import org.apache.jena.riot.Lang
import org.dbpedia.databus.client.filehandling.convert.compression.Compressor
import org.dice_research.rdfdetector.RdfSerializationDetector
import org.scalatest.funsuite.AnyFunSuite

import scala.collection.JavaConversions._

class Tests extends AnyFunSuite {

test("detect RDF ser.") {

val detector = new RdfSerializationDetector()

val u = "http://downloads.dbpedia.org/repo/dbpedia/generic/labels/2016.10.01/dataid.ttl"
// val u = "http://downloads.dbpedia.org/repo/dbpedia/generic/labels/2020.07.01/labels_lang%3dde.ttl.bz2"
val is = new URL(
u
).openStream()

val langs = detector.detect(
new BufferedInputStream(
Compressor.decompress(
new BufferedInputStream(
is
))))

is.close()
langs.foreach(println)

/** ****************************/

val lang = langs.head
val is2 = new URL(
u
).openStream()

// Lang.N3
// val cnt = RdfFileHelpers.readAsTriplesIterator(is2, lang).toIterator.size

// println(cnt)
}
}
//package org.dbpedia.databus_mods.lib.util
//
//import java.io.BufferedInputStream
//import java.net.URL
//
//import org.apache.jena.riot.Lang
//import org.dbpedia.databus.client.filehandling.convert.compression.Compressor
//import org.dice_research.rdfdetector.RdfSerializationDetector
//import org.scalatest.funsuite.AnyFunSuite
//
//import scala.collection.JavaConversions._
//
//class Tests extends AnyFunSuite {
//
// test("detect RDF ser.") {
//
// val detector = new RdfSerializationDetector()
//
// val u = "http://downloads.dbpedia.org/repo/dbpedia/generic/labels/2016.10.01/dataid.ttl"
// // val u = "http://downloads.dbpedia.org/repo/dbpedia/generic/labels/2020.07.01/labels_lang%3dde.ttl.bz2"
// val is = new URL(
// u
// ).openStream()
//
// val langs = detector.detect(
// new BufferedInputStream(
// Compressor.decompress(
// new BufferedInputStream(
// is
// ))))
//
// is.close()
// langs.foreach(println)
//
// /** ****************************/
//
// val lang = langs.head
// val is2 = new URL(
// u
// ).openStream()
//
//// Lang.N3
//// val cnt = RdfFileHelpers.readAsTriplesIterator(is2, lang).toIterator.size
//
//// println(cnt)
// }
//}

0 comments on commit 627a126

Please sign in to comment.