src/main/java/org/vivoweb/harvester/ingest/AppointmentsFetchFromED.java
/**
		 * This function returns true or false based on the OFA data for that faculty exists in VIVO
		 * @param ob The bean object containing role and education & training data both
		 * @return true or false based on the OFA data for that faculty exists in VIVO
		 * @throws IOException thrown by SDBJenaConnect
		 */
This function returns true or false based on the OFA data for that faculty exists in VIVO
@param ob The bean object containing role and education & training data both
@return true or false based on the OFA data for that faculty exists in VIVO
@throws IOException thrown by SDBJenaConnect
This function returns true or false based on the OFA data for that faculty exists in VIVO @param ob The bean object containing role and education & training data both @return true or false based on the OFA data for that faculty exists in VIVO @throws IOException thrown by SDBJenaConnect
private boolean checkOfaDataInVivo(OfaBean ob) throws IOException {
			int count = 0;
			StringBuffer sb = new StringBuffer();
			sb.append("SELECT  (count(?o) as ?positionCount) \n");
			sb.append("WHERE \n");
			sb.append("{ \n");
			sb.append("GRAPH <http://vitro.mannlib.cornell.edu/a/graph/wcmcOfa> { \n");
			sb.append("<" + this.vivoNamespace + "cwid-" + ob.getCwid().trim() + "> ?p ?o . \n");
			sb.append("}}");
			if(ingestType.equals(IngestType.VIVO_API.toString())) {
				try{
					String response = this.vivoClient.vivoQueryApi(sb.toString());
					log.info(response);
					JSONObject obj = new JSONObject(response);
					JSONArray bindings = obj.getJSONObject("results").getJSONArray("bindings");
					count = bindings.getJSONObject(0).getJSONObject("positionCount").getInt("value");
				} catch(Exception  e) {
					log.info("Api Exception", e);
				}
			} else if(ingestType.equals(IngestType.SDB_DIRECT.toString())){
				SDBJenaConnect vivoJena = this.jcf.getConnectionfromPool("dataSet");
				ResultSet rs = runSparqlTemplate(sb.toString(), vivoJena);
				QuerySolution qs = rs.nextSolution();
				count = Integer.parseInt(qs.get("positionCount").toString().replace("^^http://www.w3.org/2001/XMLSchema#integer", ""));
				if(vivoJena!= null)
					this.jcf.returnConnectionToPool(vivoJena, "dataSet");
			} else {
				TDBJenaConnect vivoJena = this.tcf.getConnectionfromPool("dataSet");
				ResultSet rs = vivoJena.executeSelectQuery(sb.toString(), true);
				QuerySolution qs = rs.nextSolution();
				count = Integer.parseInt(qs.get("positionCount").toString().replace("^^http://www.w3.org/2001/XMLSchema#integer", ""));
				if(vivoJena!= null)
					this.tcf.returnConnectionToPool(vivoJena, "dataSet");
			}
			if(count > 0)
				return true;
			return false;	
		}
private boolean checkOfaDataInVivo ( OfaBean ob ) throws IOException { int count = 0 ; StringBuffer sb = new StringBuffer ( ) ; sb . append ( "SELECT  (count(?o) as ?positionCount) \n" ) ; sb . append ( "WHERE \n" ) ; sb . append ( "{ \n" ) ; sb . append ( "GRAPH <http://vitro.mannlib.cornell.edu/a/graph/wcmcOfa> { \n" ) ; sb . append ( "<" + this . vivoNamespace + "cwid-" + ob . getCwid ( ) . trim ( ) + "> ?p ?o . \n" ) ; sb . append ( "}}" ) ; if ( ingestType . equals ( IngestType . VIVO_API . toString ( ) ) ) { try { String response = this . vivoClient . vivoQueryApi ( sb . toString ( ) ) ; log . info ( response ) ; JSONObject obj = new JSONObject ( response ) ; JSONArray bindings = obj . getJSONObject ( "results" ) . getJSONArray ( "bindings" ) ; count = bindings . getJSONObject ( 0 ) . getJSONObject ( "positionCount" ) . getInt ( "value" ) ; } catch ( Exception e ) { log . info ( "Api Exception" , e ) ; } } else if ( ingestType . equals ( IngestType . SDB_DIRECT . toString ( ) ) ) { SDBJenaConnect vivoJena = this . jcf . getConnectionfromPool ( "dataSet" ) ; ResultSet rs = runSparqlTemplate ( sb . toString ( ) , vivoJena ) ; QuerySolution qs = rs . nextSolution ( ) ; count = Integer . parseInt ( qs . get ( "positionCount" ) . toString ( ) . replace ( "^^http://www.w3.org/2001/XMLSchema#integer" , "" ) ) ; if ( vivoJena != null ) this . jcf . returnConnectionToPool ( vivoJena , "dataSet" ) ; } else { TDBJenaConnect vivoJena = this . tcf . getConnectionfromPool ( "dataSet" ) ; ResultSet rs = vivoJena . executeSelectQuery ( sb . toString ( ) , true ) ; QuerySolution qs = rs . nextSolution ( ) ; count = Integer . parseInt ( qs . get ( "positionCount" ) . toString ( ) . replace ( "^^http://www.w3.org/2001/XMLSchema#integer" , "" ) ) ; if ( vivoJena != null ) this . tcf . returnConnectionToPool ( vivoJena , "dataSet" ) ; } if ( count > 0 ) return true ; return false ; }
This function returns true or false based on the OFA data for that faculty exists in VIVO
 @param ob The bean object containing role and education & training data both
 @return true or false based on the OFA data for that faculty exists in VIVO
 @throws IOException thrown by SDBJenaConnect
This function returns true or false based on the OFA data for that faculty exists in VIVO @param ob The bean object containing role and education & training data both @return true or false based on the OFA data for that faculty exists in VIVO @throws IOException thrown by SDBJenaConnect
//Close the connection //Close the connection