Strabon

changeset 222:95960607715a

added triple counter for "triples" object in GeosparqlRDFHandlerBase
author Babis Nikolaou <charnik@di.uoa.gr>
date Fri Jun 01 13:50:20 2012 +0300 (2012-06-01)
parents a4c2938dbcda
children 1e9ab0c41d50
files runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java	Fri Jun 01 13:39:12 2012 +0300
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java	Fri Jun 01 13:50:20 2012 +0300
     1.3 @@ -42,6 +42,11 @@
     1.4  	
     1.5  	private StringBuffer triples = new StringBuffer(1024);
     1.6  	
     1.7 +	/** 
     1.8 +	 * The number of triples that the "triples" object above contains.
     1.9 +	 */
    1.10 +	private int ntriples = 0;
    1.11 +	
    1.12  	public StringBuffer getTriples()
    1.13  	{
    1.14  		return triples;
    1.15 @@ -61,6 +66,9 @@
    1.16  
    1.17  	public void endRDF() {};
    1.18  	
    1.19 +	public int getNumberOfTriples() {
    1.20 +		return ntriples;
    1.21 +	}
    1.22  	
    1.23  	public void handleStatement(Statement st)
    1.24  	{
    1.25 @@ -74,11 +82,13 @@
    1.26  			String triple = "<"+subject+ "> <"+ type +"> <"+ SpatialObject+ "> .\n" +
    1.27  					"<"+object+ "> <"+ type +"> <"+ SpatialObject+ "> .\n" ;
    1.28  			triples.append(triple);
    1.29 +			ntriples++;
    1.30  		}
    1.31  		if(predicate.equals(type)&&(object.equals(Feature) || object.equals(Geometry) ))
    1.32  		{
    1.33  			String triple = "<"+subject+ "> <"+ type +"> <"+ SpatialObject+ "> .\n";
    1.34  			triples.append(triple);
    1.35 +			ntriples++;
    1.36  		}
    1.37  		if(predicate.equals(hasGeometry))
    1.38  		{
    1.39 @@ -87,6 +97,7 @@
    1.40  					"<"+	subject+ "> <"+ type +"> <"+ SpatialObject + "> .\n" +
    1.41  					"<"+	object+ "> <"+ type +"> <"+ SpatialObject + "> .\n";
    1.42  			triples.append(triple);
    1.43 +			ntriples++;
    1.44  		}
    1.45  		if(predicate.equals(defaultGeometry))
    1.46  		{
    1.47 @@ -95,12 +106,14 @@
    1.48  					"<"+	subject+ "> <"+ type +"> <"+ SpatialObject + "> .\n"+
    1.49  			"<"+	subject+ "> <"+ hasGeometry +"> <"+ object + "> .\n";
    1.50  			triples.append(triple);
    1.51 +			ntriples++;
    1.52  		}
    1.53  		if(geometryDomainList.contains(predicate))
    1.54  		{
    1.55  			String triple = "<"+subject+ "> <"+ type +"> <"+ Geometry+ "> .\n" +
    1.56  					"<"+subject+ "> <"+ type +"> <"+ SpatialObject+ "> .\n";
    1.57  			triples.append(triple);
    1.58 +			ntriples++;
    1.59  		}
    1.60  		if (predicate.equals(type)) {
    1.61  			if (object.equals(gml + "GM_Complex")
    1.62 @@ -109,12 +122,14 @@
    1.63  				String triple = "<" + subject + "> <" + type + "> <" + gml
    1.64  						+ "GM_Object" + "> .\n";
    1.65  				triples.append(triple);
    1.66 +				ntriples++;
    1.67  			}
    1.68  			if (object.equals(gml + "GM_Composite")) {
    1.69  				String triple = "<" + subject + "> <" + type + "> <" + gml
    1.70  						+ "GM_Complex" + "> .\n" + "<" + subject + "> <" + type
    1.71  						+ "> <" + gml + "GM_Object" + "> .\n";
    1.72  				triples.append(triple);
    1.73 +				ntriples++;
    1.74  
    1.75  			}
    1.76  			if (object.equals(gml + "GM_MultiPrimitive")) {
    1.77 @@ -122,6 +137,7 @@
    1.78  						+ "GM_Aggregate" + "> .\n" + "<" + subject + "> <"
    1.79  						+ type + "> <" + gml + "GM_Object" + "> .\n";
    1.80  				triples.append(triple);
    1.81 +				ntriples++;
    1.82  
    1.83  			}
    1.84  			if (object.equals(gml + "GM_Point")
    1.85 @@ -131,6 +147,7 @@
    1.86  						+ "GM_Primitive" + "> .\n" + "<" + subject + "> <"
    1.87  						+ type + "> <" + gml + "GM_Object" + "> .\n";
    1.88  				triples.append(triple);
    1.89 +				ntriples++;
    1.90  
    1.91  			}
    1.92  			if (object.equals(gml + "GM_OrientableCurve")
    1.93 @@ -141,6 +158,7 @@
    1.94  						+ "<" + subject + "> <" + type + "> <" + gml
    1.95  						+ "GM_Object" + "> .\n";
    1.96  				triples.append(triple);
    1.97 +				ntriples++;
    1.98  
    1.99  			}
   1.100  			if (object.equals(gml + "GM_Curve")) {
   1.101 @@ -151,6 +169,7 @@
   1.102  						+ "<" + subject + "> <" + type + "> <" + gml + "GM_Primitive" + "> .\n"
   1.103  						+ "<" + subject + "> <" + type + "> <" + gml+ "GM_Object" + "> .\n";
   1.104  				triples.append(triple);
   1.105 +				ntriples++;
   1.106  
   1.107  			}
   1.108  			if (object.equals(gml + "GM_Surface")) {
   1.109 @@ -161,6 +180,7 @@
   1.110  						+ "<" + subject + "> <" + type + "> <" + gml
   1.111  						+ "GM_Object" + "> .\n";
   1.112  				triples.append(triple);
   1.113 +				ntriples++;
   1.114  
   1.115  			}
   1.116  			if (object.equals(gml + "GM_CompositeCurve")) {
   1.117 @@ -176,6 +196,7 @@
   1.118  						+ subject + "> <" + type + "> <" + gml + "GM_Object"
   1.119  						+ "> .\n";
   1.120  				triples.append(triple);
   1.121 +				ntriples++;
   1.122  
   1.123  			}
   1.124  			if (object.equals(gml + "GM_CompositeSurface")) {
   1.125 @@ -191,6 +212,7 @@
   1.126  						+ subject + "> <" + type + "> <" + gml + "GM_Object"
   1.127  						+ "> .\n";
   1.128  				triples.append(triple);
   1.129 +				ntriples++;
   1.130  
   1.131  			}
   1.132  			if (object.equals(gml + "GM_CompositeSolid")) {
   1.133 @@ -202,6 +224,7 @@
   1.134  						+ "GM_Composite" + "> .\n" + "<" + subject + "> <"
   1.135  						+ type + "> <" + gml + "GM_Object" + "> .\n";
   1.136  				triples.append(triple);
   1.137 +				ntriples++;
   1.138  
   1.139  			}
   1.140  			if (object.equals(gml + "GM_MultiPoint")
   1.141 @@ -214,6 +237,7 @@
   1.142  						+ subject + "> <" + type + "> <" + gml + "GM_Object"
   1.143  						+ "> .\n";
   1.144  				triples.append(triple);
   1.145 +				ntriples++;
   1.146  
   1.147  			}
   1.148  			if (object.equals(sf + "Point") || object.equals(sf + "Curve")
   1.149 @@ -222,12 +246,14 @@
   1.150  				String triple = "<" + subject + "> <" + type + "> <" + sf
   1.151  						+ "Geometry" + "> .\n";
   1.152  				triples.append(triple);
   1.153 +				ntriples++;
   1.154  			}
   1.155  			if (object.equals(sf + "LineString")) {
   1.156  				String triple = "<" + subject + "> <" + type + "> <" + sf
   1.157  						+ "Geometry" + "> .\n" + "<" + subject + "> <" + type
   1.158  						+ "> <" + sf + "Curve" + "> .\n";
   1.159  				triples.append(triple);
   1.160 +				ntriples++;
   1.161  			}
   1.162  			if (object.equals(sf + "Line") || object.equals(sf + "LinearRing")) {
   1.163  				String triple = "<" + subject + "> <" + type + "> <" + sf
   1.164 @@ -235,12 +261,14 @@
   1.165  						+ "> <" + sf + "Curve" + "> .\n" + "<" + subject
   1.166  						+ "> <" + type + "> <" + sf + "LineString" + "> .\n";
   1.167  				triples.append(triple);
   1.168 +				ntriples++;
   1.169  			}
   1.170  			if (object.equals(sf + "Polygon")) {
   1.171  				String triple = "<" + subject + "> <" + type + "> <" + sf
   1.172  						+ "Geometry" + "> .\n" + "<" + subject + "> <" + type
   1.173  						+ "> <" + sf + "Surface" + "> .\n";
   1.174  				triples.append(triple);
   1.175 +				ntriples++;
   1.176  			}
   1.177  			if (object.equals(sf + "MultiSurface")
   1.178  					|| object.equals(sf + "MultiCurve")
   1.179 @@ -249,6 +277,7 @@
   1.180  						+ "Geometry" + "> .\n" + "<" + subject + "> <" + type
   1.181  						+ "> <" + sf + "GeometryCollection" + "> .\n";
   1.182  				triples.append(triple);
   1.183 +				ntriples++;
   1.184  			}
   1.185  			if (object.equals(sf + "MultiPolygon")) {
   1.186  				String triple = "<" + subject + "> <" + type + "> <" + sf
   1.187 @@ -257,6 +286,7 @@
   1.188  						+ "> <" + type + "> <" + sf + "GeometryCollection"
   1.189  						+ "> .\n";
   1.190  				triples.append(triple);
   1.191 +				ntriples++;
   1.192  			}
   1.193  			if (object.equals(sf + "MultiLineString")) {
   1.194  				String triple = "<" + subject + "> <" + type + "> <" + sf
   1.195 @@ -265,15 +295,9 @@
   1.196  						+ "> <" + type + "> <" + sf + "GeometryCollection"
   1.197  						+ "> .\n";
   1.198  				triples.append(triple);
   1.199 +				ntriples++;
   1.200  			}
   1.201  		}
   1.202 -
   1.203 -		
   1.204 -	
   1.205 -				
   1.206 -		
   1.207 -		//triples.append("niania\n");
   1.208 -		
   1.209  	}
   1.210  	
   1.211