sparqlGraphLibrary/src/main/java/com/ge/research/semtk/edc/JobTracker.java
public void deleteJobsAndFiles(Date boundaryDate, TableResultsStorage trstore) throws AuthorizationException, Exception {
		
		// --- delete binary files --- 
		SparqlGraphJson sgjGetPaths = new SparqlGraphJson(Utility.getResourceAsJson(this, "/nodegroups/job_get_file_info.json"));
		sgjGetPaths.setSparqlConn(this.createOverrideConnection());
		NodeGroup ngGetPaths = sgjGetPaths.getNodeGroup();
		
		// add creationTime constraint
		PropertyItem creationTime = ngGetPaths.getPropertyItemBySparqlID("creationTime");
		String creationTimeConstraint = ValueConstraint.buildFilterConstraint(creationTime, "<", boundaryDate);	
		creationTime.setValueConstraint(new ValueConstraint(creationTimeConstraint));
		
		// delete binary files: query paths, then delete
		String query = ngGetPaths.generateSparql(AutoGeneratedQueryTypes.SELECT_DISTINCT, false, -1, null);
		SparqlEndpointInterface endpoint = this.createSuperuserEndpoint();
	    Table pathTable = endpoint.executeQueryToTable(query);
		String paths[] = pathTable.getColumn("path");
		for (String p : paths) {
			this.deleteBinaryFile(p);
		}
		
		// --- delete result file storage --- 
		ArrayList<URL> resultsUrls = this.getResultsUrls(boundaryDate);
		for (URL u : resultsUrls) {
			if (trstore != null) {
				trstore.fullDelete(u);
			} else {
				LocalLogger.logToStdErr("Leaving file for later cleanup: " + u.toString());
			}
		}

		// --- delete from triplestore --- 
		SparqlGraphJson sgjJobDeletion = new SparqlGraphJson(Utility.getResourceAsJson(this, "/nodegroups/job_deletion.json"));
		sgjJobDeletion.setSparqlConn(this.createOverrideConnection());
		NodeGroup ngJobDel = sgjJobDeletion.getNodeGroup();
		
		// add creationTime constraint
		creationTime = ngJobDel.getPropertyItemBySparqlID("creationTime");
		creationTimeConstraint = ValueConstraint.buildFilterConstraint(creationTime, "<", boundaryDate);	
		creationTime.setValueConstraint(new ValueConstraint(creationTimeConstraint));
		
		// run
		query = ngJobDel.generateSparqlDelete();
		
		// we've already checked that user is JobAdmin.  So user can delete jobs from triplestore.
		endpoint = this.createSuperuserEndpoint();
		endpoint.executeQueryAndConfirm(query);
		LocalLogger.logToStdOut("Deleted jobs from triplestore: " + creationTimeConstraint);

		
	}
/**
	 * Delete job from triplestore, delete binary files and their parents if empty, delete table storage if provided
	 * @param boundaryDate
	 * @param trstore - may be null
	 * @throws Exception
	 */
Delete job from triplestore, delete binary files and their parents if empty, delete table storage if provided
@param boundaryDate
@param trstore - may be null
@throws Exception
Delete job from triplestore delete binary files and their parents if empty delete table storage if provided @param boundaryDate @param trstore - may be null @throws Exception
public void deleteJobsAndFiles(Date boundaryDate, TableResultsStorage trstore) throws AuthorizationException, Exception {
		SparqlGraphJson sgjGetPaths = new SparqlGraphJson(Utility.getResourceAsJson(this, "/nodegroups/job_get_file_info.json"));
		sgjGetPaths.setSparqlConn(this.createOverrideConnection());
		NodeGroup ngGetPaths = sgjGetPaths.getNodeGroup();
		PropertyItem creationTime = ngGetPaths.getPropertyItemBySparqlID("creationTime");
		String creationTimeConstraint = ValueConstraint.buildFilterConstraint(creationTime, "<", boundaryDate);	
		creationTime.setValueConstraint(new ValueConstraint(creationTimeConstraint));
		String query = ngGetPaths.generateSparql(AutoGeneratedQueryTypes.SELECT_DISTINCT, false, -1, null);
		SparqlEndpointInterface endpoint = this.createSuperuserEndpoint();
	    Table pathTable = endpoint.executeQueryToTable(query);
		String paths[] = pathTable.getColumn("path");
		for (String p : paths) {
			this.deleteBinaryFile(p);
		}
		ArrayList<URL> resultsUrls = this.getResultsUrls(boundaryDate);
		for (URL u : resultsUrls) {
			if (trstore != null) {
				trstore.fullDelete(u);
			} else {
				LocalLogger.logToStdErr("Leaving file for later cleanup: " + u.toString());
			}
		}
		SparqlGraphJson sgjJobDeletion = new SparqlGraphJson(Utility.getResourceAsJson(this, "/nodegroups/job_deletion.json"));
		sgjJobDeletion.setSparqlConn(this.createOverrideConnection());
		NodeGroup ngJobDel = sgjJobDeletion.getNodeGroup();
		creationTime = ngJobDel.getPropertyItemBySparqlID("creationTime");
		creationTimeConstraint = ValueConstraint.buildFilterConstraint(creationTime, "<", boundaryDate);	
		creationTime.setValueConstraint(new ValueConstraint(creationTimeConstraint));
		query = ngJobDel.generateSparqlDelete();
		endpoint = this.createSuperuserEndpoint();
		endpoint.executeQueryAndConfirm(query);
		LocalLogger.logToStdOut("Deleted jobs from triplestore: " + creationTimeConstraint);
	}
public void deleteJobsAndFiles ( Date boundaryDate , TableResultsStorage trstore ) throws AuthorizationException , Exception { SparqlGraphJson sgjGetPaths = new SparqlGraphJson ( Utility . getResourceAsJson ( this , "/nodegroups/job_get_file_info.json" ) ) ; sgjGetPaths . setSparqlConn ( this . createOverrideConnection ( ) ) ; NodeGroup ngGetPaths = sgjGetPaths . getNodeGroup ( ) ; PropertyItem creationTime = ngGetPaths . getPropertyItemBySparqlID ( "creationTime" ) ; String creationTimeConstraint = ValueConstraint . buildFilterConstraint ( creationTime , "<" , boundaryDate ) ; creationTime . setValueConstraint ( new ValueConstraint ( creationTimeConstraint ) ) ; String query = ngGetPaths . generateSparql ( AutoGeneratedQueryTypes . SELECT_DISTINCT , false , - 1 , null ) ; SparqlEndpointInterface endpoint = this . createSuperuserEndpoint ( ) ; Table pathTable = endpoint . executeQueryToTable ( query ) ; String paths [ ] = pathTable . getColumn ( "path" ) ; for ( String p : paths ) { this . deleteBinaryFile ( p ) ; } ArrayList < URL > resultsUrls = this . getResultsUrls ( boundaryDate ) ; for ( URL u : resultsUrls ) { if ( trstore != null ) { trstore . fullDelete ( u ) ; } else { LocalLogger . logToStdErr ( "Leaving file for later cleanup: " + u . toString ( ) ) ; } } SparqlGraphJson sgjJobDeletion = new SparqlGraphJson ( Utility . getResourceAsJson ( this , "/nodegroups/job_deletion.json" ) ) ; sgjJobDeletion . setSparqlConn ( this . createOverrideConnection ( ) ) ; NodeGroup ngJobDel = sgjJobDeletion . getNodeGroup ( ) ; creationTime = ngJobDel . getPropertyItemBySparqlID ( "creationTime" ) ; creationTimeConstraint = ValueConstraint . buildFilterConstraint ( creationTime , "<" , boundaryDate ) ; creationTime . setValueConstraint ( new ValueConstraint ( creationTimeConstraint ) ) ; query = ngJobDel . generateSparqlDelete ( ) ; endpoint = this . createSuperuserEndpoint ( ) ; endpoint . executeQueryAndConfirm ( query ) ; LocalLogger . logToStdOut ( "Deleted jobs from triplestore: " + creationTimeConstraint ) ; }
Delete job from triplestore, delete binary files and their parents if empty, delete table storage if provided
 @param boundaryDate
 @param trstore - may be null
 @throws Exception
Delete job from triplestore delete binary files and their parents if empty delete table storage if provided @param boundaryDate @param trstore - may be null @throws Exception
// --- delete binary files ---  // add creationTime constraint // delete binary files: query paths, then delete // --- delete result file storage ---  // --- delete from triplestore ---  // add creationTime constraint // run // we've already checked that user is JobAdmin.  So user can delete jobs from triplestore.