use of org.apache.jena.atlas.data.SerializationFactory in project jena by apache.
the class SerializationFactoryFinder method quadSerializationFactory.
public static SerializationFactory<Quad> quadSerializationFactory() {
return new SerializationFactory<Quad>() {
@Override
public Sink<Quad> createSerializer(OutputStream out) {
return new SinkQuadOutput(out, null, NodeToLabel.createBNodeByLabelEncoded());
}
@Override
public Iterator<Quad> createDeserializer(InputStream in) {
Tokenizer tokenizer = TokenizerFactory.makeTokenizerASCII(in);
ParserProfile profile = RiotLib.createParserProfile(RiotLib.factoryRDF(LabelToNode.createUseLabelEncoded()), ErrorHandlerFactory.errorHandlerNoWarnings, IRIResolver.createNoResolve(), false);
LangNQuads parser = new LangNQuads(tokenizer, profile, null);
return parser;
}
@Override
public long getEstimatedMemorySize(Quad item) {
// TODO
return 0;
}
};
}
use of org.apache.jena.atlas.data.SerializationFactory in project jena by apache.
the class SerializationFactoryFinder method tripleSerializationFactory.
public static SerializationFactory<Triple> tripleSerializationFactory() {
return new SerializationFactory<Triple>() {
@Override
public Sink<Triple> createSerializer(OutputStream out) {
return new SinkTripleOutput(out, null, NodeToLabel.createBNodeByLabelEncoded());
}
@Override
public Iterator<Triple> createDeserializer(InputStream in) {
Tokenizer tokenizer = TokenizerFactory.makeTokenizerASCII(in);
ParserProfile profile = RiotLib.createParserProfile(RiotLib.factoryRDF(LabelToNode.createUseLabelEncoded()), ErrorHandlerFactory.errorHandlerNoWarnings, IRIResolver.createNoResolve(), false);
LangNTriples parser = new LangNTriples(tokenizer, profile, null);
return parser;
}
@Override
public long getEstimatedMemorySize(Triple item) {
// TODO
return 0;
}
};
}
Aggregations