AGSerializers.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGSerializers {
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem", e);
}
AllegroGraph ts = ags.renew("serializers", AGPaths.TRIPLE_STORES);
String ntripleFile = AGPaths.dataSources("temporal.nt");
System.out.println("Loading N-Triples " + ntripleFile);
ts.loadNTriples(ntripleFile);
System.out.println("Loaded " + ts.numberOfTriples() + " triples.");
NTriplesSerializer ntser = new NTriplesSerializer();
ntser.setDestination(AGPaths.dataSources("temporal-serialized.nt"));
ntser.setIfExists("supersede");
ntser.run(ts);
RDFSerializer rdfser = new RDFSerializer();
rdfser.setDestination(AGPaths.dataSources("temporal-serialized.rdf"));
rdfser.setIfExists("supersede");
rdfser.run(ts);
RDFN3Serializer rdfn3ser = new RDFN3Serializer();
rdfn3ser.setDestination(AGPaths.dataSources("temporal-serialized.n3"));
rdfn3ser.setIfExists("supersede");
rdfn3ser.run(ts);
RDFManifestSerializer rdfmanser = new RDFManifestSerializer();
rdfmanser.setDestination(AGPaths.dataSources("temporal-serialized.manifest"));
rdfmanser.run(ts);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next