public static Resource getLatest(RepositoryConnection con, RepositoryResult<Statement> statementIterator, URI timeProperty) throws RepositoryException {
			Resource latestResource = null;
			SimpleDateFormat sdf = D2S_Utils.getSimpleDateFormat();
			
			while (statementIterator.hasNext()) {
				Statement s = statementIterator.next();
				Resource r = (Resource) s
						.getObject();

				RepositoryResult<Statement> timeIterator = con
						.getStatements(r,
								timeProperty, null, true);

				Date latest = null;
				while (timeIterator.hasNext()) {
					Statement timeStatement = timeIterator
							.next();

					String cacheTime = timeStatement.getObject()
							.stringValue();

					Date time;

					try {
						time = sdf.parse(cacheTime);

						if (latest == null) {
							latest = time;
							latestResource = r;

						} else if (time.after(latest)) {
							latest = time;
							latestResource = r;
						}
					} catch (ParseException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}

				}	
				
				
			}
			


			
			return latestResource ;
		}