Strabon

changeset 768:cdfdf384451a temporals

now valid time instants are used as typed literals without the use of brackets (as in the case of periods)
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Thu Dec 06 20:35:27 2012 +0200 (2012-12-06)
parents d715fd304e9e
children b2aae972c2dd
files runtime/src/main/java/eu/earthobservatory/runtime/generaldb/QuadRDFHandler.java 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	Sat Dec 01 21:21:42 2012 +0200
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/QuadRDFHandler.java	Thu Dec 06 20:35:27 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	Sat Dec 01 21:21:42 2012 +0200
     2.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Thu Dec 06 20:35:27 2012 +0200
     2.3 @@ -562,8 +562,19 @@
     2.4  			Iterator iterator = statements.iterator();
     2.5  			for(Statement st: statements)
     2.6  			{
     2.7 +				String cont = st.getContext().toString();
     2.8 +				 String validPeriod= cont;
     2.9 +				 if(!cont.contains(","))
    2.10 +				 {
    2.11 +					 int i = cont.indexOf('"')+1;
    2.12 +					 int j = cont.lastIndexOf('"');
    2.13 +					 validPeriod = "\"[" + cont.substring(i,j) + "," + cont.substring(i,j) + "]\"^^<http://strdf.di.uoa.gr/ontology#validTime>"; 
    2.14 +					 //validPeriod = cont.replace("]",","+cont.substring(i, j)+"]");
    2.15 +					 
    2.16 +				 }
    2.17 +				 
    2.18  				try {
    2.19 -					Resource newContext = new NQuadsParser().createValidTimeURI(st.getContext().toString());
    2.20 +					Resource newContext = new NQuadsParser().createValidTimeURI(validPeriod);
    2.21  					con1.add(st.getSubject(), st.getPredicate(), st.getObject(), newContext);
    2.22  				} catch (ParseException e) {
    2.23  					logger.error(this.getClass().toString()+": error when constructing the new context");