Strabon

changeset 771:069e5acada90 temporals

merge
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Fri Dec 07 18:13:20 2012 +0200 (2012-12-07)
parents 6aa5f315664a b2aae972c2dd
children 20246a8b5544
files runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/QuadRDFHandler.java	Fri Dec 07 18:13:07 2012 +0200
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/QuadRDFHandler.java	Fri Dec 07 18:13:20 2012 +0200
     1.3 @@ -57,10 +57,11 @@
     1.4  						 String validPeriod= context;
     1.5  						 if(!context.contains(","))
     1.6  						 {
     1.7 -							 int i = context.indexOf('[')+1;
     1.8 -							 int j = context.indexOf(']');
     1.9 -							 validPeriod = context.replace("]",","+context.substring(i, j)+"]");
    1.10 -							 
    1.11 +							 int i = context.indexOf('"')+1;
    1.12 +							 int j = context.lastIndexOf('"');
    1.13 +							 validPeriod = "\"[" + context.substring(i,j)+","+context.substring(i,j) + "]\"^^<http://strdf.di.uoa.gr/ontology#validTime>"; 
    1.14 +
    1.15 +							// validPeriod = context.replace("]",","+context.substring(i, j)+"]");
    1.16  						 }
    1.17  					 Resource graph = parser.createValidTimeURI(validPeriod);
    1.18  					 
     2.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Fri Dec 07 18:13:07 2012 +0200
     2.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Fri Dec 07 18:13:20 2012 +0200
     2.3 @@ -498,9 +498,10 @@
     2.4  					 String validPeriod= cont;
     2.5  					 if(!cont.contains(","))
     2.6  					 {
     2.7 -						 int i = cont.indexOf('[')+1;
     2.8 -						 int j = cont.indexOf(']');
     2.9 -						 validPeriod = cont.replace("]",","+cont.substring(i, j)+"]");
    2.10 +						 int i = cont.indexOf('"')+1;
    2.11 +						 int j = cont.lastIndexOf('"');
    2.12 +						 validPeriod = "\"[" + cont.substring(i,j) + "," + cont.substring(i,j) + "]\"^^<http://strdf.di.uoa.gr/ontology#validTime>"; 
    2.13 +						 //validPeriod = cont.replace("]",","+cont.substring(i, j)+"]");
    2.14  						 
    2.15  					 }
    2.16  					Resource newContext = new NQuadsParser().createValidTimeURI(validPeriod);
    2.17 @@ -563,8 +564,19 @@
    2.18  			Iterator iterator = statements.iterator();
    2.19  			for(Statement st: statements)
    2.20  			{
    2.21 +				String cont = st.getContext().toString();
    2.22 +				 String validPeriod= cont;
    2.23 +				 if(!cont.contains(","))
    2.24 +				 {
    2.25 +					 int i = cont.indexOf('"')+1;
    2.26 +					 int j = cont.lastIndexOf('"');
    2.27 +					 validPeriod = "\"[" + cont.substring(i,j) + "," + cont.substring(i,j) + "]\"^^<http://strdf.di.uoa.gr/ontology#validTime>"; 
    2.28 +					 //validPeriod = cont.replace("]",","+cont.substring(i, j)+"]");
    2.29 +					 
    2.30 +				 }
    2.31 +				 
    2.32  				try {
    2.33 -					Resource newContext = new NQuadsParser().createValidTimeURI(st.getContext().toString());
    2.34 +					Resource newContext = new NQuadsParser().createValidTimeURI(validPeriod);
    2.35  					con1.add(st.getSubject(), st.getPredicate(), st.getObject(), newContext);
    2.36  				} catch (ParseException e) {
    2.37  					logger.error(this.getClass().toString()+": error when constructing the new context");