package won.protocol.highlevel;

import org.apache.jena.query.Dataset;

import won.utils.acknowledgement.AcknowledgedSelection;


public class HighlevelProtocols {
	/**
	 * Calculates all agreements present in the specified conversation dataset.
	 */
	public static Dataset getAgreements(Dataset conversationDataset) {
		//TODO: use AcknowledgedSelection, ModifiedSelection, and AgreementFunction 
		//to calculate agrements
		AcknowledgedSelection acknowledgedSelection = new AcknowledgedSelection();
		Dataset result = acknowledgedSelection.applyAcknowledgedSelection(conversationDataset);
		
		return null;
	}
	
	/**
	 * Calculates all open proposals present in the specified conversation dataset.
	 * @param conversationDataset
	 * @return
	 */
	public static Dataset getProposals(Dataset conversationDataset) {
		//TODO: use AcknowledgedSelection, ModifiedSelection, and a (yet to be created ProposalFunction)
		//to calculate all open proposals.
		return null;
	}
	
	
}

@@ -126,16 +126,158 @@
 ction;%0D%0A
+import won.utils.agreement.AgreementFunction;%0D%0Aimport won.utils.modification.ModifiedSelection;%0D%0Aimport won.utils.proposal.ProposalFunction;%0D%0A
 %0D%0A%0D%0Apubl
@@ -464,35 +464,73 @@
 taset) %7B%0D%0A%09%09
-//TODO: use
+AcknowledgedSelection acknowledgedSelection = new
  Acknowledge
@@ -531,33 +531,44 @@
 wledgedSelection
-,
+();%0D%0A       
  ModifiedSelecti
@@ -573,65 +573,140 @@
 tion
-, and AgreementFunction %0D%0A%09%09//to calculate a
+ modifiedSelection = new ModifiedSelection();%0D%0A        AgreementFunction agreementFunction = new A
 gre
+e
 ment
-s%0D%0A%09%09A
+Function();%0D%0A%0D%0A%09%09Dataset a
 ckno
@@ -708,33 +708,26 @@
 acknowledged
-Selection
+ =
  acknowledge
@@ -728,39 +728,38 @@
 wledgedSelection
- = new 
+.apply
 AcknowledgedSele
@@ -768,99 +768,193 @@
 ion(
-);%0D%0A%09%09Dataset result = acknowledgedSelection.applyAcknowledgedSelection(conversationDataset
+conversationDataset);%0D%0A        Dataset modified = modifiedSelection.applyModificationSelection(acknowledged);%0D%0A        Dataset agreed = agreementFunction.applyAgreementFunction(modified
 );%0D%0A
@@ -958,36 +958,38 @@
 ;%0D%0A%09%09%0D%0A%09%09return 
-null
+agreed
 ;%0D%0A%09%7D%0D%0A%09%0D%0A%09/**%0D%0A
@@ -1193,21 +1193,65 @@
  %7B%0D%0A
-%09%09//TODO: use
+        AcknowledgedSelection acknowledgedSelection = new
  Ack
@@ -1268,17 +1268,28 @@
 election
-,
+();%0D%0A       
  Modifie
@@ -1302,116 +1302,425 @@
 tion
-, and a (yet to be created ProposalFunction)%0D%0A%09%09//to calculate all open proposals.%0D%0A%09%09return null;%0D%0A%09%7D%0D%0A%09%0D%0A%09
+ modifiedSelection = new ModifiedSelection();%0D%0A        ProposalFunction proposalFunction = new ProposalFunction();%0D%0A%0D%0A        Dataset acknowledged = acknowledgedSelection.applyAcknowledgedSelection(conversationDataset);%0D%0A        Dataset modified = modifiedSelection.applyModificationSelection(acknowledged);%0D%0A        Dataset proposed = proposalFunction.applyProposalFunction(modified);%0D%0A%0D%0A        return proposed;%0D%0A%09%7D
 %0D%0A%7D%0D

implement HighlevelProtocols