sparqlGraphLibrary/src/main/java/com/ge/research/semtk/sparqlX/dispatch/DispatchServiceManager.java
private void edcNodegroupCheckRestrictions() throws BadQueryException, Exception {
		if (this.mneRestrictions == null || ! this.heedRestrictions) return;
		
		String [] classURI = this.mneRestrictions.getColumn(0);
		String [] operator = this.mneRestrictions.getColumn(1);
		String [] operand = this.mneRestrictions.getColumn(2);
		String [] sparqlID = new String[classURI.length];
		
		NodeGroup tmpNodegroup = NodeGroup.deepCopy(edcNodegroup);
		
		// loop through the checks
		for (int i=0; i < classURI.length; i++) {			
			// Find the required class (or it's superclass)
			// If it doesn't exist, add it so we can count how many will come back
			boolean includeSubclasses = true;
			Node snode = tmpNodegroup.getOrAddNode(classURI[i], this.oInfo, includeSubclasses);
			snode.setIsReturned(true);
			sparqlID[i] = snode.getSparqlID();
			
		}
			
		// run the query
		String sparql = tmpNodegroup.generateSparql(AutoGeneratedQueryTypes.SELECT_DISTINCT, false, -1, null);
		Table table = this.extConfigSei.executeQueryToTable(sparql);
				
		for (int i=0; i < classURI.length; i++) {			
			int count = table.getColumnUniqueValues(sparqlID[i]).length;
	
			int intOperand = Integer.parseInt(operand[i]);
			String shortURI = new OntologyName(classURI[i]).getLocalName();

			if (operator[i].equals("==")) {

				if (count != intOperand) {
					String msg = String.format("EDC query restriction requires exactly %d values for %s.  %d found.", intOperand, shortURI, count);
					throw new BadQueryException(msg);
				}

			} else if (operator[i].equals("<=")) {

				if (count > intOperand) {
					String msg = String.format("EDC query restriction requires at most %d values for %s.  %d found.", intOperand, shortURI, count);
					throw new BadQueryException(msg);
				}

			} else if (operator[i].equals(">=")) {

				if (count < intOperand) {
					String msg = String.format("EDC query restriction requires at least %d values for %s.  %d found.", intOperand, shortURI, count);
					throw new BadQueryException(msg);
				}
			}
		}
	}
/** run queries to perform checks on nodegroup and throw Exceptions if fails
	 * 
	 * @throws BadQueryException (check failed), Exception (internal errors)
	 */
run queries to perform checks on nodegroup and throw Exceptions if fails

@throws BadQueryException (check failed), Exception (internal errors)
run queries to perform checks on nodegroup and throw Exceptions if fails @throws BadQueryException ( check failed ) Exception ( internal errors )
private void edcNodegroupCheckRestrictions() throws BadQueryException, Exception {
		if (this.mneRestrictions == null || ! this.heedRestrictions) return;
		String [] classURI = this.mneRestrictions.getColumn(0);
		String [] operator = this.mneRestrictions.getColumn(1);
		String [] operand = this.mneRestrictions.getColumn(2);
		String [] sparqlID = new String[classURI.length];
		NodeGroup tmpNodegroup = NodeGroup.deepCopy(edcNodegroup);
		for (int i=0; i < classURI.length; i++) {			
			boolean includeSubclasses = true;
			Node snode = tmpNodegroup.getOrAddNode(classURI[i], this.oInfo, includeSubclasses);
			snode.setIsReturned(true);
			sparqlID[i] = snode.getSparqlID();
		}
		String sparql = tmpNodegroup.generateSparql(AutoGeneratedQueryTypes.SELECT_DISTINCT, false, -1, null);
		Table table = this.extConfigSei.executeQueryToTable(sparql);
		for (int i=0; i < classURI.length; i++) {			
			int count = table.getColumnUniqueValues(sparqlID[i]).length;
			int intOperand = Integer.parseInt(operand[i]);
			String shortURI = new OntologyName(classURI[i]).getLocalName();
			if (operator[i].equals("==")) {
				if (count != intOperand) {
					String msg = String.format("EDC query restriction requires exactly %d values for %s.  %d found.", intOperand, shortURI, count);
					throw new BadQueryException(msg);
				}
			} else if (operator[i].equals("<=")) {
				if (count > intOperand) {
					String msg = String.format("EDC query restriction requires at most %d values for %s.  %d found.", intOperand, shortURI, count);
					throw new BadQueryException(msg);
				}
			} else if (operator[i].equals(">=")) {
				if (count < intOperand) {
					String msg = String.format("EDC query restriction requires at least %d values for %s.  %d found.", intOperand, shortURI, count);
					throw new BadQueryException(msg);
				}
			}
		}
	}
private void edcNodegroupCheckRestrictions ( ) throws BadQueryException , Exception { if ( this . mneRestrictions == null || ! this . heedRestrictions ) return ; String [ ] classURI = this . mneRestrictions . getColumn ( 0 ) ; String [ ] operator = this . mneRestrictions . getColumn ( 1 ) ; String [ ] operand = this . mneRestrictions . getColumn ( 2 ) ; String [ ] sparqlID = new String [ classURI . length ] ; NodeGroup tmpNodegroup = NodeGroup . deepCopy ( edcNodegroup ) ; for ( int i = 0 ; i < classURI . length ; i ++ ) { boolean includeSubclasses = true ; Node snode = tmpNodegroup . getOrAddNode ( classURI [ i ] , this . oInfo , includeSubclasses ) ; snode . setIsReturned ( true ) ; sparqlID [ i ] = snode . getSparqlID ( ) ; } String sparql = tmpNodegroup . generateSparql ( AutoGeneratedQueryTypes . SELECT_DISTINCT , false , - 1 , null ) ; Table table = this . extConfigSei . executeQueryToTable ( sparql ) ; for ( int i = 0 ; i < classURI . length ; i ++ ) { int count = table . getColumnUniqueValues ( sparqlID [ i ] ) . length ; int intOperand = Integer . parseInt ( operand [ i ] ) ; String shortURI = new OntologyName ( classURI [ i ] ) . getLocalName ( ) ; if ( operator [ i ] . equals ( "==" ) ) { if ( count != intOperand ) { String msg = String . format ( "EDC query restriction requires exactly %d values for %s.  %d found." , intOperand , shortURI , count ) ; throw new BadQueryException ( msg ) ; } } else if ( operator [ i ] . equals ( "<=" ) ) { if ( count > intOperand ) { String msg = String . format ( "EDC query restriction requires at most %d values for %s.  %d found." , intOperand , shortURI , count ) ; throw new BadQueryException ( msg ) ; } } else if ( operator [ i ] . equals ( ">=" ) ) { if ( count < intOperand ) { String msg = String . format ( "EDC query restriction requires at least %d values for %s.  %d found." , intOperand , shortURI , count ) ; throw new BadQueryException ( msg ) ; } } } }
run queries to perform checks on nodegroup and throw Exceptions if fails
run queries to perform checks on nodegroup and throw Exceptions if fails
// loop through the checks // Find the required class (or it's superclass) // If it doesn't exist, add it so we can count how many will come back // run the query