Skip to content

Commit

Permalink
small issue, fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
alismayilov committed Apr 22, 2015
1 parent e21f92c commit daf11f7
Showing 1 changed file with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,28 @@ class WikidataReferenceExtractor(
override def extract(page: JsonNode, subjectUri: String, pageContext: PageContext): Seq[Quad] = {
val quads = new ArrayBuffer[Quad]()

if (subjectUri == "http://wikidata.dbpedia.org/resource/Q1339" ){
for (statementGroup <- page.wikiDataDocument.getStatementGroups) {
statementGroup.getStatements.foreach {
statement => {
val references = statement.getReferences
val property = statement.getClaim().getMainSnak().getPropertyId().getIri
if (!references.isEmpty) {
for (i <- references.indices) {
for (reference <- references.get(i).getAllSnaks) {
reference match {
case snak: ValueSnak => {
val value = snak.getValue
val statementUri = WikidataUtil.getStatementUri(subjectUri, property, value)
val datatype = if (WikidataUtil.getDatatype(value) != null) context.ontology.datatypes(WikidataUtil.getDatatype(value)) else null
quads += new Quad(context.language, DBpediaDatasets.WikidataReference, statementUri, referenceProperty, WikidataUtil.getValue(value), page.wikiPage.sourceUri,datatype)
}
case _=>
for (statementGroup <- page.wikiDataDocument.getStatementGroups) {
statementGroup.getStatements.foreach {
statement => {
val references = statement.getReferences
val property = statement.getClaim().getMainSnak().getPropertyId().getIri
if (!references.isEmpty) {
for (i <- references.indices) {
for (reference <- references.get(i).getAllSnaks) {
reference match {
case snak: ValueSnak => {
val value = snak.getValue
val statementUri = WikidataUtil.getStatementUri(subjectUri, property, value)
val datatype = if (WikidataUtil.getDatatype(value) != null) context.ontology.datatypes(WikidataUtil.getDatatype(value)) else null
quads += new Quad(context.language, DBpediaDatasets.WikidataReference, statementUri, referenceProperty, WikidataUtil.getValue(value), page.wikiPage.sourceUri, datatype)
}
case _ =>
}
}
}
}

}

}
}

Expand Down

0 comments on commit daf11f7

Please sign in to comment.