Strabon

changeset 1000:84881daa5d6c

added GeoSPARQL vocabulary class. Currently, it holds only the namespaces, the classes, and the geometry properties
author Babis Nikolaou <charnik@di.uoa.gr>
date Fri Apr 05 22:18:02 2013 +0300 (2013-04-05)
parents 0a4b5f4aab1f
children d944f100abbc
files constants/src/main/java/eu/earthobservatory/constants/GeoConstants.java constants/src/main/java/eu/earthobservatory/vocabulary/GeoSPARQL.java runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java
line diff
     1.1 --- a/constants/src/main/java/eu/earthobservatory/constants/GeoConstants.java	Fri Apr 05 22:04:04 2013 +0300
     1.2 +++ b/constants/src/main/java/eu/earthobservatory/constants/GeoConstants.java	Fri Apr 05 22:18:02 2013 +0300
     1.3 @@ -13,6 +13,7 @@
     1.4  import java.util.ArrayList;
     1.5  import java.util.List;
     1.6  
     1.7 +import eu.earthobservatory.vocabulary.GeoSPARQL;
     1.8  import eu.earthobservatory.vocabulary.SimpleFeatures;
     1.9  
    1.10  /**
    1.11 @@ -48,12 +49,12 @@
    1.12  	/**
    1.13  	 * The namespace for GeoSPARQL ontology
    1.14  	 */
    1.15 -	public static final String GEO						= "http://www.opengis.net/ont/geosparql#";
    1.16 +	public static final String GEO						= GeoSPARQL.GEO;
    1.17  	
    1.18  	/**
    1.19  	 * The namespace for geometry functions declared by GeoSPARQL
    1.20  	 */
    1.21 -	public static final String GEOF						= "http://www.opengis.net/def/function/geosparql/";
    1.22 +	public static final String GEOF						= GeoSPARQL.GEOF;
    1.23  	
    1.24  	/**
    1.25  	 * The namespace for the ontology of simple features
    1.26 @@ -106,8 +107,8 @@
    1.27  	/**
    1.28  	 * The URIs for GeoSPARQL properties
    1.29  	 */
    1.30 -	public static final String GEOhasGeometry			=  GEO + "hasGeometry";
    1.31 -	public static final String GEOdefaultGeometry		=  GEO + "defaultGeometry";
    1.32 +	public static final String GEOhasGeometry			=  GeoSPARQL.hasGeometry;
    1.33 +	public static final String GEOdefaultGeometry		=  GeoSPARQL.hasDefaultGeometry;
    1.34  	public static final String GEOdimension				=  GEO + "dimension";
    1.35  	public static final String GEOcoordinateDimension	=  GEO + "coordinateDimension";
    1.36  	public static final String GEOspatialDimension	    =  GEO + "spatialDimension";
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/constants/src/main/java/eu/earthobservatory/vocabulary/GeoSPARQL.java	Fri Apr 05 22:18:02 2013 +0300
     2.3 @@ -0,0 +1,42 @@
     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.vocabulary;
    2.14 +
    2.15 +
    2.16 +/**
    2.17 + * GeoSPARQL vocabulary, version 1.0.1, Document  11-052r4
    2.18 + * <a>http://schemas.opengis.net/geosparql/geosparql-1_0_1.zip</a>
    2.19 + * 
    2.20 + * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    2.21 + */
    2.22 +public class GeoSPARQL {
    2.23 +	
    2.24 +	public static final String ONTOLOGY_NAMESPACE 	= "http://www.opengis.net/ont/geosparql#";
    2.25 +	public static final String FUNCTION_NAMESPACE 	= "http://www.opengis.net/def/function/geosparql/";
    2.26 +	public static final String RULE_NAMESPACE 		= "http://www.opengis.net/def/rule/geosparql/";
    2.27 +	
    2.28 +	public static final String GEO  = ONTOLOGY_NAMESPACE;
    2.29 +	public static final String GEOF = FUNCTION_NAMESPACE;
    2.30 +	public static final String GEOR = RULE_NAMESPACE;
    2.31 +	
    2.32 +	/**
    2.33 +	 *  Defined Classes
    2.34 +	 */
    2.35 +	public static final String SpatialObject 		= GEO + "SpatialObject";
    2.36 +	public static final String Feature 				= GEO + "Feature";
    2.37 +	public static final String Geometry				= GEO + "Geometry";
    2.38 +	
    2.39 +	/**
    2.40 +	 * Defined geometry properties
    2.41 +	 */
    2.42 +	public static final String hasGeometry 			= GEO + "hasGeometry";
    2.43 +	public static final String hasDefaultGeometry	= GEO + "hasDefaultGeometry";
    2.44 +
    2.45 +}
     3.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java	Fri Apr 05 22:04:04 2013 +0300
     3.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java	Fri Apr 05 22:18:02 2013 +0300
     3.3 @@ -20,6 +20,7 @@
     3.4  import org.openrdf.rio.ntriples.NTriplesParser;
     3.5  
     3.6  import eu.earthobservatory.constants.GeoConstants;
     3.7 +import eu.earthobservatory.vocabulary.GeoSPARQL;
     3.8  import eu.earthobservatory.vocabulary.SimpleFeatures;
     3.9  
    3.10  /**
    3.11 @@ -34,12 +35,6 @@
    3.12  	private static String TYPE = RDF.TYPE.stringValue();
    3.13  	private static String SUBCLASS = RDFS.SUBCLASSOF.stringValue();
    3.14  	
    3.15 -	public static String SpatialObject 			= GeoConstants.GEO + "SpatialObject";
    3.16 -	public static String Feature 				= GeoConstants.GEO + "Feature";
    3.17 -	public static String Geometry				= GeoConstants.GEO + "Geometry";
    3.18 -	public static String hasGeometry 			= GeoConstants.GEO + "hasGeometry";
    3.19 -	public static String hasDefaultGeometry		= GeoConstants.GEO + "hasDefaultGeometry";
    3.20 -	
    3.21  	public static List <String> GM_Objects = Arrays.asList("GM_Complex", "GM_Agreggate", "GM_Primitive", "GM_Composite", "GM_MultiPrimitive",
    3.22  			"GM_Point", "GM_OrientablePrimitive","GM_OrientableCurve","GM_OrientableSurface", "GM_Curve","GM_Surface","GM_Solid",
    3.23  			 "GM_CompositeCurve", "GM_CompositeSurface", "GM_CompositeSolid", "GM_Multipoint", "GM_MultiCurve", "GM_MultiSurface", "GM_MultiSolid");
    3.24 @@ -82,8 +77,8 @@
    3.25  			pred.startsWith(GeoConstants.GEO+"eh") || 
    3.26  			pred.startsWith(GeoConstants.GEO+"rcc8"))
    3.27  		{
    3.28 -			writeTriple(subj, TYPE, SpatialObject);
    3.29 -			writeTriple(obj, TYPE, SpatialObject);
    3.30 +			writeTriple(subj, TYPE, GeoSPARQL.SpatialObject);
    3.31 +			writeTriple(obj, TYPE, GeoSPARQL.SpatialObject);
    3.32  		}
    3.33  		/* Infer 
    3.34  		 * 		subj rdf:type geo:SpatialObject
    3.35 @@ -92,9 +87,9 @@
    3.36  		 * or
    3.37  		 * 		subj rdf:type geo:Geometry 
    3.38  		 */
    3.39 -		else if(pred.equals(TYPE) && (obj.equals(Feature) || obj.equals(Geometry)))
    3.40 +		else if(pred.equals(TYPE) && (obj.equals(GeoSPARQL.Feature) || obj.equals(GeoSPARQL.Geometry)))
    3.41  		{
    3.42 -			writeTriple(subj, TYPE, SpatialObject);
    3.43 +			writeTriple(subj, TYPE, GeoSPARQL.SpatialObject);
    3.44  		} 
    3.45  		/*
    3.46  		 * Infer
    3.47 @@ -107,13 +102,13 @@
    3.48  		 * or
    3.49  		 * 		sub geo:hasDefaultGeometry obj
    3.50  		 */
    3.51 -		else if(pred.equals(hasGeometry) || pred.equals(hasDefaultGeometry))
    3.52 +		else if(pred.equals(GeoSPARQL.hasGeometry) || pred.equals(GeoSPARQL.hasDefaultGeometry))
    3.53  		{
    3.54 -			writeTriple(subj, TYPE, Feature);
    3.55 -			writeTriple(subj, TYPE, SpatialObject);
    3.56 +			writeTriple(subj, TYPE, GeoSPARQL.Feature);
    3.57 +			writeTriple(subj, TYPE, GeoSPARQL.SpatialObject);
    3.58  			
    3.59 -			writeTriple(obj, TYPE, Feature);
    3.60 -			writeTriple(obj, TYPE, SpatialObject);
    3.61 +			writeTriple(obj, TYPE, GeoSPARQL.Feature);
    3.62 +			writeTriple(obj, TYPE, GeoSPARQL.SpatialObject);
    3.63  		}
    3.64  		else if (pred.equals(TYPE)) {
    3.65  			// GML class hierarchy
    3.66 @@ -305,8 +300,8 @@
    3.67  					GeoConstants.GEOisSimple.equals(pred) 		     || GeoConstants.GEOhasSerialization.equals(pred)   ||
    3.68  					GeoConstants.GEOasWKT.equals(pred)	 || GeoConstants.GEOasGML.equals(pred)) {
    3.69  			
    3.70 -			writeTriple(subj, TYPE, Geometry);
    3.71 -			writeTriple(subj, TYPE, SpatialObject);
    3.72 +			writeTriple(subj, TYPE, GeoSPARQL.Geometry);
    3.73 +			writeTriple(subj, TYPE, GeoSPARQL.SpatialObject);
    3.74  		}
    3.75  	}
    3.76