-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Vehnem/master
rdf-detector fix
- Loading branch information
Showing
2 changed files
with
76 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 47 additions & 47 deletions
94
databus-mods-lib/src/test/scala/org/dbpedia/databus_mods/lib/util/Tests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
// } | ||
//} |