src/main/java/org/vivoweb/harvester/ingest/AcademicFetchFromED.java
/**
		 * This function will sync all the personTypeCodes from ED with VIVO rdf types
		 * @param pb The PeopleBean conatining all people information from ED
		 */
This function will sync all the personTypeCodes from ED with VIVO rdf types
@param pb The PeopleBean conatining all people information from ED
This function will sync all the personTypeCodes from ED with VIVO rdf types @param pb The PeopleBean conatining all people information from ED
private void syncPersonTypes(PeopleBean pb) {
			log.info("Syncing personTypeCodes from ED with VIVO for " + pb.getCwid());
			StringBuilder sb = new StringBuilder();
			sb.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n");
			sb.append("PREFIX wcmc: <http://weill.cornell.edu/vivo/ontology/wcmc#> \n");
			sb.append("PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n");
			sb.append("PREFIX vivo: <http://vivoweb.org/ontology/core#> \n");
			sb.append("PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n");
			sb.append("PREFIX obo: <http://purl.obolibrary.org/obo/> \n");
			sb.append("PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n");
			sb.append("PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> \n");
			sb.append( "PREFIX core: <http://vivoweb.org/ontology/core#> \n");
			sb.append("WITH <http://vitro.mannlib.cornell.edu/a/graph/wcmcPeople> \n");
            sb.append("DELETE { \n");
            sb.append("<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() + "> rdf:type ?o .\n");
            sb.append("} \n");
            sb.append("INSERT { \n");
            sb.append("<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() + "> rdf:type foaf:Person . \n");
            sb.append("<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() +"> rdf:type <http://xmlns.com/foaf/0.1/Agent> . \n");
			sb.append("<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() +"> rdf:type <http://purl.obolibrary.org/obo/BFO_0000001> . \n");
			sb.append("<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() +"> rdf:type <http://purl.obolibrary.org/obo/BFO_0000002> . \n");
			sb.append("<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() +"> rdf:type <http://purl.obolibrary.org/obo/BFO_0000004> . \n");
			sb.append("<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() +"> rdf:type <http://www.w3.org/2002/07/owl#Thing> . \n");
			for(String nsType: pb.getNsTypes()) {
				sb.append("<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() + "> rdf:type " + nsType + " . \n");
			}
            sb.append("} \n");
            sb.append("WHERE { \n");
            sb.append("OPTIONAL {<" + this.vivoNamespace + "cwid-" + pb.getCwid().trim() + "> rdf:type ?o . }\n");
            sb.append("}");
            log.info(sb.toString());
			if(ingestType.equals(IngestType.VIVO_API.toString())) {
				try {
					log.info(this.vivoClient.vivoUpdateApi(sb.toString()));
				} catch(Exception e) {
					log.error("Api Exception", e);
				}
			} else if(ingestType.equals(IngestType.SDB_DIRECT.toString())){
				TDBJenaConnect vivoJena = this.tcf.getConnectionfromPool("dataSet");
				try {
					runSparqlUpdateTemplate(sb.toString(), vivoJena);
				} catch(IOException e) {
					log.error("IOException: ",e);
				}
				if(vivoJena!= null)
					this.tcf.returnConnectionToPool(vivoJena, "dataSet");
			} else {
				TDBJenaConnect vivoJena = this.tcf.getConnectionfromPool("dataSet");
				try {
					runTDBSparqlUpdateTemplate(sb.toString(), vivoJena);
				} catch(IOException e) {
					log.error("IOException: ",e);
				}
				if(vivoJena!= null)
					this.tcf.returnConnectionToPool(vivoJena, "dataSet");
			}
		}
private void syncPersonTypes ( PeopleBean pb ) { log . info ( "Syncing personTypeCodes from ED with VIVO for " + pb . getCwid ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n" ) ; sb . append ( "PREFIX wcmc: <http://weill.cornell.edu/vivo/ontology/wcmc#> \n" ) ; sb . append ( "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" ) ; sb . append ( "PREFIX vivo: <http://vivoweb.org/ontology/core#> \n" ) ; sb . append ( "PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n" ) ; sb . append ( "PREFIX obo: <http://purl.obolibrary.org/obo/> \n" ) ; sb . append ( "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" ) ; sb . append ( "PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> \n" ) ; sb . append ( "PREFIX core: <http://vivoweb.org/ontology/core#> \n" ) ; sb . append ( "WITH <http://vitro.mannlib.cornell.edu/a/graph/wcmcPeople> \n" ) ; sb . append ( "DELETE { \n" ) ; sb . append ( "<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type ?o .\n" ) ; sb . append ( "} \n" ) ; sb . append ( "INSERT { \n" ) ; sb . append ( "<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type foaf:Person . \n" ) ; sb . append ( "<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type <http://xmlns.com/foaf/0.1/Agent> . \n" ) ; sb . append ( "<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type <http://purl.obolibrary.org/obo/BFO_0000001> . \n" ) ; sb . append ( "<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type <http://purl.obolibrary.org/obo/BFO_0000002> . \n" ) ; sb . append ( "<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type <http://purl.obolibrary.org/obo/BFO_0000004> . \n" ) ; sb . append ( "<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type <http://www.w3.org/2002/07/owl#Thing> . \n" ) ; for ( String nsType : pb . getNsTypes ( ) ) { sb . append ( "<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type " + nsType + " . \n" ) ; } sb . append ( "} \n" ) ; sb . append ( "WHERE { \n" ) ; sb . append ( "OPTIONAL {<" + this . vivoNamespace + "cwid-" + pb . getCwid ( ) . trim ( ) + "> rdf:type ?o . }\n" ) ; sb . append ( "}" ) ; log . info ( sb . toString ( ) ) ; if ( ingestType . equals ( IngestType . VIVO_API . toString ( ) ) ) { try { log . info ( this . vivoClient . vivoUpdateApi ( sb . toString ( ) ) ) ; } catch ( Exception e ) { log . error ( "Api Exception" , e ) ; } } else if ( ingestType . equals ( IngestType . SDB_DIRECT . toString ( ) ) ) { TDBJenaConnect vivoJena = this . tcf . getConnectionfromPool ( "dataSet" ) ; try { runSparqlUpdateTemplate ( sb . toString ( ) , vivoJena ) ; } catch ( IOException e ) { log . error ( "IOException: " , e ) ; } if ( vivoJena != null ) this . tcf . returnConnectionToPool ( vivoJena , "dataSet" ) ; } else { TDBJenaConnect vivoJena = this . tcf . getConnectionfromPool ( "dataSet" ) ; try { runTDBSparqlUpdateTemplate ( sb . toString ( ) , vivoJena ) ; } catch ( IOException e ) { log . error ( "IOException: " , e ) ; } if ( vivoJena != null ) this . tcf . returnConnectionToPool ( vivoJena , "dataSet" ) ; } }
This function will sync all the personTypeCodes from ED with VIVO rdf types
 @param pb The PeopleBean conatining all people information from ED
This function will sync all the personTypeCodes from ED with VIVO rdf types @param pb The PeopleBean conatining all people information from ED