VIVO-1018 RiotReader.createIteratorTriples() assumes an ASCII stream, so we need a different method.
This commit is contained in:
parent
b26d824cb2
commit
c7979c05a7
1 changed files with 5 additions and 8 deletions
|
@ -6,8 +6,6 @@ import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndex
|
||||||
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.START_REBUILD;
|
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.START_REBUILD;
|
||||||
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.UNPAUSE;
|
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.UNPAUSE;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -17,8 +15,9 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.jena.riot.RDFLanguages;
|
|
||||||
import org.apache.jena.riot.RiotReader;
|
import org.apache.jena.riot.RiotReader;
|
||||||
|
import org.apache.jena.riot.tokens.Tokenizer;
|
||||||
|
import org.apache.jena.riot.tokens.TokenizerFactory;
|
||||||
|
|
||||||
import com.hp.hpl.jena.graph.Triple;
|
import com.hp.hpl.jena.graph.Triple;
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
@ -142,9 +141,9 @@ public class IndexingChangeListener implements ChangeListener,
|
||||||
private Statement parseTriple(String serializedTriple) {
|
private Statement parseTriple(String serializedTriple) {
|
||||||
try {
|
try {
|
||||||
// Use RiotReader to parse a Triple
|
// Use RiotReader to parse a Triple
|
||||||
// NB A Triple can be serialized correctly with: FmtUtils.stringForTriple(triple, PrefixMapping.Factory.create()) + " .";
|
// NB A Triple can be serialized correctly with: FmtUtils.stringForTriple(triple, PrefixMapping.Factory.create()) + " .";'
|
||||||
ByteArrayInputStream input = new ByteArrayInputStream(serializedTriple.getBytes("UTF-8"));
|
Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(serializedTriple);
|
||||||
Iterator<Triple> it = RiotReader.createIteratorTriples(input, RDFLanguages.NTRIPLES, null);
|
Iterator<Triple> it = RiotReader.createParserNTriples(tokenizer, null);
|
||||||
|
|
||||||
if (it.hasNext()) {
|
if (it.hasNext()) {
|
||||||
Triple triple = it.next();
|
Triple triple = it.next();
|
||||||
|
@ -164,8 +163,6 @@ public class IndexingChangeListener implements ChangeListener,
|
||||||
} catch (RuntimeException riot) {
|
} catch (RuntimeException riot) {
|
||||||
log.error("Failed to parse triple " + serializedTriple, riot);
|
log.error("Failed to parse triple " + serializedTriple, riot);
|
||||||
throw riot;
|
throw riot;
|
||||||
} catch (UnsupportedEncodingException uee) {
|
|
||||||
throw new RuntimeException(uee);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue