Strabon

changeset 1016:25935f0ef8d7

Added GeneralDBSailRepository and GeneralDBSailRepositoryConnection that extend SailRepository and SailRepositoryConnection so as to override insertion of triples using our implementation of an RDFInserter that will implement the GeoSPARQL Entailment Extension. Now, this is implemented in GeosparqlRDFHandlerBase at the cost of parsing the input twice!
author Babis Nikolaou <charnik@di.uoa.gr>
date Tue Apr 09 00:23:16 2013 +0300 (2013-04-09)
parents f2f0cc6cff02
children 093aeabd52a7
files runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeneralDBSailRepository.java runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeneralDBSailRepositoryConnection.java runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeneralDBSailRepository.java	Tue Apr 09 00:23:16 2013 +0300
     1.3 @@ -0,0 +1,42 @@
     1.4 +/**
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 + * 
     1.9 + * Copyright (C) 2013, Pyravlos Team
    1.10 + * 
    1.11 + * http://www.strabon.di.uoa.gr/
    1.12 + */
    1.13 +package eu.earthobservatory.runtime.generaldb;
    1.14 +
    1.15 +import org.openrdf.repository.RepositoryException;
    1.16 +import org.openrdf.repository.sail.SailRepository;
    1.17 +import org.openrdf.repository.sail.SailRepositoryConnection;
    1.18 +import org.openrdf.sail.Sail;
    1.19 +import org.openrdf.sail.SailException;
    1.20 +
    1.21 +/**
    1.22 + * This class extends SailRepository only to be able to create
    1.23 + * connections that are instances of our class {@link GeneralDBSailRepositoryConnection}
    1.24 + * instead of Sesame's {@link SailRepositoryConnection}. See class
    1.25 + * {@link GeneralDBSailRepositoryConnection} for the reason behind
    1.26 + * this extension.
    1.27 + * 
    1.28 + * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    1.29 + */
    1.30 +public class GeneralDBSailRepository extends SailRepository {
    1.31 +
    1.32 +	public GeneralDBSailRepository(Sail sail) {
    1.33 +		super(sail);
    1.34 +	}
    1.35 +	
    1.36 +	@Override
    1.37 +	public SailRepositoryConnection getConnection() throws RepositoryException {
    1.38 +		try {
    1.39 +			return new GeneralDBSailRepositoryConnection(this, getSail().getConnection());
    1.40 +		}
    1.41 +		catch (SailException e) {
    1.42 +			throw new RepositoryException(e);
    1.43 +		}
    1.44 +	}
    1.45 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeneralDBSailRepositoryConnection.java	Tue Apr 09 00:23:16 2013 +0300
     2.3 @@ -0,0 +1,32 @@
     2.4 +/**
     2.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     2.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     2.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     2.8 + * 
     2.9 + * Copyright (C) 2013, Pyravlos Team
    2.10 + * 
    2.11 + * http://www.strabon.di.uoa.gr/
    2.12 + */
    2.13 +package eu.earthobservatory.runtime.generaldb;
    2.14 +
    2.15 +import org.openrdf.repository.sail.SailRepository;
    2.16 +import org.openrdf.repository.sail.SailRepositoryConnection;
    2.17 +import org.openrdf.sail.SailConnection;
    2.18 +
    2.19 +/**
    2.20 + * This class extends {@link SailRepositoryConnection} only to allow
    2.21 + * for overriding insertion of triples by invoking our implementation
    2.22 + * of {@link RDFInserter} so that GeoSPARQL Entailment Extension is 
    2.23 + * incorporated there in a seamless way.  
    2.24 + * 
    2.25 + * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    2.26 + */
    2.27 +public class GeneralDBSailRepositoryConnection extends SailRepositoryConnection {
    2.28 +
    2.29 +	protected GeneralDBSailRepositoryConnection(SailRepository repository, SailConnection sailConnection) {
    2.30 +		super(repository, sailConnection);
    2.31 +	}
    2.32 +	
    2.33 +	// TODO add the respective add method that will call an extension of the RDFInserter
    2.34 +
    2.35 +}
     3.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Mon Apr 08 18:16:06 2013 +0300
     3.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Tue Apr 09 00:23:16 2013 +0300
     3.3 @@ -128,7 +128,8 @@
     3.4  		System.setProperty("org.geotools.referencing.forceXY", "true");
     3.5  		
     3.6  		//our repository
     3.7 -		repo1 = new SailRepository(db_store);
     3.8 +		//repo1 = new SailRepository(db_store);
     3.9 +		repo1 = new GeneralDBSailRepository(db_store);
    3.10  
    3.11  		try {
    3.12  			repo1.initialize();