Skip to content

Commit 17dcaa8

Browse files
committed
updated load function in CompositeExtractor to take Type arg not PageNode
1 parent e26ef81 commit 17dcaa8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

core/src/main/scala/org/dbpedia/extraction/mappings/CompositeExtractor.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import org.dbpedia.extraction.destinations.Quad
44
import org.dbpedia.extraction.wikiparser.PageNode
55
import org.dbpedia.extraction.mappings.Extractor
66

7-
class CompositeExtractor(extractors: Seq[Extractor[PageNode]])
8-
extends CompositeMapping[PageNode](extractors: _*)
9-
with Extractor[PageNode]
7+
class CompositeExtractor[T](extractors: Seq[Extractor[T]])
8+
extends CompositeMapping[T](extractors: _*)
9+
with Extractor[T]
1010

1111
/**
1212
* Creates new extractors.
@@ -18,22 +18,22 @@ object CompositeExtractor
1818
*
1919
* TODO: using reflection here loses compile-time type safety.
2020
*
21-
* @param extractors List of extractor classes to be instantiated
21+
* @param classes List of extractor classes to be instantiated
2222
* @param context Any type of object that implements the required parameter methods for the extractors
2323
*/
24-
def load(classes: Seq[Class[_ <: Extractor[_]]], context: AnyRef): Extractor[PageNode] =
24+
def load[T](classes: Seq[Class[_ <: Extractor[_]]], context: AnyRef): Extractor[T] =
2525
{
2626
val extractors = classes.map(_.getConstructor(classOf[AnyRef]).newInstance(context))
2727

28-
var pageNodeExtractors : Seq[Extractor[PageNode]] = Seq.empty
28+
val selectedExtractors : Seq[Extractor[T]] = Seq.empty
2929

3030
extractors foreach { extractor : Extractor[_] =>
3131
extractor match {
32-
case ex : Extractor[PageNode] => pageNodeExtractors :+ ex
32+
case ex : Extractor[T] => selectedExtractors :+ ex
3333
case _ =>
34-
}
34+
}
3535
}
3636

37-
new CompositeExtractor(pageNodeExtractors: Seq[Extractor[PageNode]])
37+
new CompositeExtractor[T](selectedExtractors: Seq[Extractor[T]])
3838
}
3939
}

dump/src/main/scala/org/dbpedia/extraction/dump/extract/ConfigLoader.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ConfigLoader(config: Config)
121121
}
122122

123123
//Extractors
124-
val extractor = CompositeExtractor.load(extractorClasses, context)
124+
val extractor = CompositeExtractor.load[PageNode](extractorClasses, context)
125125
val datasets = extractor.datasets
126126

127127
var formats = new ArrayBuffer[Destination]()

0 commit comments

Comments
 (0)