Search in sources :

Example 1 with ArgsConfig

use of org.apache.jena.fuseki.geosparql.cli.ArgsConfig in project jena by apache.

the class TDB2Test method setUpClass.

@BeforeClass
public static void setUpClass() throws DatasetException, SpatialIndexException {
    File tempTDBDir = Files.createTempDir();
    String[] args = { "-rf", "geosparql_test.rdf>xml", "-i", "-t", tempTDBDir.getAbsolutePath(), "-t2" };
    ArgsConfig argsConfig = new ArgsConfig();
    JCommander.newBuilder().addObject(argsConfig).build().parse(args);
    // Setup dataset
    Dataset dataset = DatasetOperations.setup(argsConfig);
    // Configure server
    SERVER = new GeosparqlServer(argsConfig.getPort(), argsConfig.getDatsetName(), argsConfig.isLoopbackOnly(), dataset, argsConfig.isUpdateAllowed());
    SERVER.start();
}
Also used : ArgsConfig(org.apache.jena.fuseki.geosparql.cli.ArgsConfig) Dataset(org.apache.jena.query.Dataset) File(java.io.File)

Example 2 with ArgsConfig

use of org.apache.jena.fuseki.geosparql.cli.ArgsConfig in project jena by apache.

the class MainTest method setUpClass.

@BeforeClass
public static void setUpClass() throws DatasetException, SpatialIndexException {
    String[] args = { "-rf", "geosparql_test.rdf>xml", "-i" };
    ArgsConfig argsConfig = new ArgsConfig();
    JCommander.newBuilder().addObject(argsConfig).build().parse(args);
    // Setup dataset
    Dataset dataset = DatasetOperations.setup(argsConfig);
    // Configure server
    SERVER = new GeosparqlServer(argsConfig.getPort(), argsConfig.getDatsetName(), argsConfig.isLoopbackOnly(), dataset, argsConfig.isUpdateAllowed());
    SERVER.start();
}
Also used : ArgsConfig(org.apache.jena.fuseki.geosparql.cli.ArgsConfig) Dataset(org.apache.jena.query.Dataset)

Example 3 with ArgsConfig

use of org.apache.jena.fuseki.geosparql.cli.ArgsConfig in project jena by apache.

the class TDBTest method setUpClass.

@BeforeClass
public static void setUpClass() throws DatasetException, SpatialIndexException {
    File tempTDBDir = Files.createTempDir();
    String[] args = { "-rf", "geosparql_test.rdf>xml", "-i", "-t", tempTDBDir.getAbsolutePath() };
    ArgsConfig argsConfig = new ArgsConfig();
    JCommander.newBuilder().addObject(argsConfig).build().parse(args);
    // Setup dataset
    Dataset dataset = DatasetOperations.setup(argsConfig);
    // Configure server
    SERVER = new GeosparqlServer(argsConfig.getPort(), argsConfig.getDatsetName(), argsConfig.isLoopbackOnly(), dataset, argsConfig.isUpdateAllowed());
    SERVER.start();
}
Also used : ArgsConfig(org.apache.jena.fuseki.geosparql.cli.ArgsConfig) Dataset(org.apache.jena.query.Dataset) File(java.io.File)

Example 4 with ArgsConfig

use of org.apache.jena.fuseki.geosparql.cli.ArgsConfig in project jena by apache.

the class Main method main.

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    // Apache SIS j.u.l logging redirection.
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
    LOGGER.info("Arguments Received: {}", Arrays.asList(args));
    ArgsConfig argsConfig = new ArgsConfig();
    JCommander jCommander = JCommander.newBuilder().addObject(argsConfig).build();
    jCommander.setProgramName("GeoSPARQL Fuseki");
    jCommander.parse(args);
    if (argsConfig.isHelp()) {
        jCommander.usage();
        return;
    }
    // Setup dataset
    try {
        Dataset dataset = DatasetOperations.setup(argsConfig);
        // Configure server
        GeosparqlServer server = new GeosparqlServer(argsConfig.getPort(), argsConfig.getDatsetName(), argsConfig.isLoopbackOnly(), dataset, argsConfig.isUpdateAllowed());
        server.start();
    } catch (SrsException | DatasetException | SpatialIndexException ex) {
        LOGGER.error("GeoSPARQL Server:  Exiting - {}: {}", ex.getMessage(), argsConfig.getDatsetName());
    }
}
Also used : SrsException(org.apache.jena.geosparql.configuration.SrsException) ArgsConfig(org.apache.jena.fuseki.geosparql.cli.ArgsConfig) JCommander(com.beust.jcommander.JCommander) Dataset(org.apache.jena.query.Dataset) SpatialIndexException(org.apache.jena.geosparql.spatial.SpatialIndexException)

Example 5 with ArgsConfig

use of org.apache.jena.fuseki.geosparql.cli.ArgsConfig in project jena by apache.

the class EmptyTest method setUpClass.

@BeforeClass
public static void setUpClass() throws DatasetException, SpatialIndexException {
    String[] args = { "-u" };
    ArgsConfig argsConfig = new ArgsConfig();
    JCommander.newBuilder().addObject(argsConfig).build().parse(args);
    // Setup dataset
    Dataset dataset = DatasetOperations.setup(argsConfig);
    // Configure server
    SERVER = new GeosparqlServer(argsConfig.getPort(), argsConfig.getDatsetName(), argsConfig.isLoopbackOnly(), dataset, argsConfig.isUpdateAllowed());
    SERVER.start();
    // Add data
    String update = "PREFIX geo: <http://www.opengis.net/ont/geosparql#>\n" + "\n" + "INSERT DATA{" + "<http://example.org/Geometry#LineStringA> geo:hasSerialization \"LINESTRING(0 0, 10 10)\"^^<http://www.opengis.net/ont/geosparql#wktLiteral>;" + " a geo:Geometry ;" + " a geo:SpatialObject ." + "<http://example.org/Geometry#LineStringB> geo:hasSerialization \"LINESTRING(0 5, 10 5)\"^^<http://www.opengis.net/ont/geosparql#wktLiteral>;" + " a geo:Geometry ;" + " a geo:SpatialObject ." + "<http://example.org/Geometry#PointC> geo:hasSerialization \"POINT(5 5)\"^^<http://www.opengis.net/ont/geosparql#wktLiteral>;" + " a geo:Geometry ;" + " a geo:SpatialObject ." + "}";
    UpdateRequest updateRequest = UpdateFactory.create(update);
    UpdateExecution updateProcessor = UpdateExecution.service(SERVER.getLocalServiceURL()).update(updateRequest).build();
    updateProcessor.execute();
}
Also used : ArgsConfig(org.apache.jena.fuseki.geosparql.cli.ArgsConfig)

Aggregations

ArgsConfig (org.apache.jena.fuseki.geosparql.cli.ArgsConfig)5 Dataset (org.apache.jena.query.Dataset)4 File (java.io.File)2 JCommander (com.beust.jcommander.JCommander)1 SrsException (org.apache.jena.geosparql.configuration.SrsException)1 SpatialIndexException (org.apache.jena.geosparql.spatial.SpatialIndexException)1