AGGeospatialCartesianData.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGGeospatialCartesianData {
@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("geospatialcartesiandata", AGPaths.TRIPLE_STORES);
ts.registerNamespace("ex","http://example.org/places/");
ts.registerNamespace("geo","http://franz.com/ns/allegrograph/3.0/geospatial/");
GeoExtension geo = ts.getGeoExtension();
GeospatialSubtype subtype = geo.registerCartesianStriping(0, 1, 0, 1, .01);
geo.addSubtype(subtype);
UPI upi = geo.encodeUPI(subtype, .25, .75);
Object[] location = geo.decodeUPI(upi);
AGUtils.printObjectArray("Location:", location);
ts.addStatement("!ex:pointA", "!ex:location", upi);
Cursor cc = ts.getStatements(null,null,null);
AGUtils.showTriples(cc);
NTriplesSerializer ntser = new NTriplesSerializer();
ntser.setDestination(AGPaths.dataSources("cartesian-serialized.nt"));
ntser.setIfExists("supersede");
ntser.run(ts);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next