AGSerializers.java
package com.franz.agbase.examples;
import com.franz.agbase.*;
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);
AGLoadNtriples.loadNTriplesWithTiming(ts, AGPaths.dataSources("temporal.nt"));
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);
TriplesIterator cc = ts.getStatements(null,null,"<http://example.org/pt3>");
AGUtils.showTriples(cc);
ntser.setDestination(AGPaths.dataSources("temporal-intervals-using-pt3.nt"));
ntser.setIfExists("supersede");
cc = ts.getStatements(null,null,"<http://example.org/pt3>");
ntser = new NTriplesSerializer();
ntser.setDestination(null);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next