amon key
amon key

--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,7 @@
 [submodule "lib/bubbletree"]
 	path = lib/bubbletree
 	url = https://github.com/okfn/bubbletree.git
+[submodule "lib/amon-php"]
+	path = lib/amon-php
+	url = https://github.com/martinrusev/amon-php.git
 

--- a/admin/neo4jimporter/pom.xml
+++ b/admin/neo4jimporter/pom.xml
@@ -7,7 +7,7 @@
   	<dependency>
   		<groupId>org.neo4j</groupId>
   		<artifactId>neo4j</artifactId>
-  		<version>1.6.1</version>
+  		<version>1.8.RC1</version>
   	</dependency>
   	<dependency>
     <groupId>postgresql</groupId>

--- a/admin/neo4jimporter/src/main/java/Importer.java
+++ b/admin/neo4jimporter/src/main/java/Importer.java
@@ -1,8 +1,4 @@
 
-import java.io.ObjectInputStream.GetField;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
@@ -10,7 +6,6 @@
 import java.sql.SQLWarning;
 import java.sql.Statement;
 import java.util.HashMap;
-import java.util.Map;
 
 import org.neo4j.graphdb.DynamicRelationshipType;
 import org.neo4j.graphdb.GraphDatabaseService;
@@ -18,9 +13,9 @@
 import org.neo4j.graphdb.index.BatchInserterIndex;
 import org.neo4j.graphdb.index.BatchInserterIndexProvider;
 import org.neo4j.helpers.collection.MapUtil;
+import org.neo4j.index.impl.lucene.LuceneBatchInserterIndexProvider;
 import org.neo4j.kernel.impl.batchinsert.BatchInserter;
 import org.neo4j.kernel.impl.batchinsert.BatchInserterImpl;
-import org.neo4j.index.impl.lucene.*;
 
 public class Importer {
 
@@ -84,8 +79,7 @@
             // Execute the query
             ResultSet rs = stmt.executeQuery("SELECT contractnotice.\"agencyName\", "
                     + "  contractnotice.\"supplierABN\",contractnotice.\"supplierName\",sum(value) as sum "
-                    + "FROM  public.contractnotice where contractnotice.\"agencyName\" != 'Department of Defence'"
-                    + " AND contractnotice.\"agencyName\" != 'Defence Materiel Organisation' GROUP BY contractnotice.\"agencyName\", "
+                    + "FROM  public.contractnotice  GROUP BY contractnotice.\"agencyName\", "
                     + "  contractnotice.\"supplierABN\",contractnotice.\"supplierName\"");
             String previousAgency = "";
             GraphDatabaseService gds = inserter.getGraphDbService();

--- a/displayCalendar.php
+++ b/displayCalendar.php
@@ -2,11 +2,17 @@
 

 include_once("./lib/common.inc.php");

 

-include_header("Months and Years");

+

 

 if ($_REQUEST['month']) {

-    echo "<center><h1>" . $_REQUEST['month'] . "</h1></center>";

     $monthParts = explode("-", $_REQUEST['month']);

+    $year = $monthParts[1];

+    $month = $monthParts[0];

+    $monthName = date("F Y",  mktime(0,0,0,$month,1,$year));

+            

+    include_header($monthName);

+    echo "<center><h1>" . $monthName . "</h1></center>";

+    

     $query = 'SELECT "CNID", "description", "value", "agencyName", "category", "contractStart", "supplierName"

     FROM contractnotice

     WHERE "childCN" is null

@@ -52,7 +58,7 @@
       Year/Month drilldown - largest contracts, agencies, suppliers

       count per month

       big picture graphs? */

-

+include_header("Months and Years");

 

     ContractStartingGraph();

     ContractPublishedGraph();


--- a/displayCategory.php
+++ b/displayCategory.php
@@ -1,7 +1,7 @@
 <?php

 include_once ("./lib/common.inc.php");

 if ($_REQUEST['category']) {

-    include_header("Category");

+    include_header($_REQUEST['category']." goods and services");

     echo "<center><h1>".$_REQUEST['category']."</h1></center>";

   $query = 'SELECT "CNID", description, value, "agencyName", category, "contractStart", "supplierName"

     FROM contractnotice


--- a/displayContract.php
+++ b/displayContract.php
@@ -18,28 +18,58 @@
 } else {

 $description = ucsmart($contractResult["description"]);

 include_header($description);

- echo '<center><h1>'.$description.'</h1></center>';

+ echo '<center><h1>'.$description.'</h1></center>

+     <div about="http://contracts.disclosurelo.gs/displayContract.php?CNID='.$contractResult["CNID"].'" typeof="pc:Contract">';

 databaseError($conn->errorInfo());

     setlocale(LC_MONETARY, 'en_US');

     foreach (array_filter($contractResult) as $key => $value) {

         echo "<b>$key</b>&nbsp;";

         switch ($key) {

+            case "supplierABN":

+            break;

             case "supplierName":

-            case "supplierABN":

-                echo '<a href="displaySupplier.php?supplier=' . $contractResult['supplierABN'] . '-' . urlencode($contractResult['supplierName']) . '">' . $value . "</a>";

+                echo '

+                    <a href="displaySupplier.php?supplier=' . $contractResult['supplierABN'] . '-' . urlencode($contractResult['supplierName']) . '">

+                        <span rel="pc:contractingAuthority" typeof="gr:BusinessEntity">

+                        <span property="gr:legalName">' 

+                    . $contractResult['supplierName'] . 

+                    '</span>'.

+                    (isset($contractResult['supplierABN']) && $contractResult['supplierABN'] != '' ? ' (ABN: <span property="br:officialNumber" lang="">'.$contractResult['supplierABN'].'</span>)' : '')

+                        .'</span></a>';

+                break;

+            case "CNID":

+                echo '<span property="pc:referenceNumber" lang="">'.$value.'</span>';

+                break;

+            case "categoryUNSPSC":

+                break;

+            case "category":

+                echo '<span rel="pc:mainObject" resource="[unspsc:'.$contractResult["categoryUNSPSC"].']">'.$value.'</span>';

                 break;

             case "agencyName":

                 echo '<a href="displayAgency.php?agency=' . urlencode($value) . '">' . $value . "</a>";

                 break;

+            case "contractStart":

+                echo '<span property="pc:startDate" content="'.$value.'" datatype="xsd:date">'.$value.'</span>';

+                break;

+            case "contractEnd":

+                echo '<span property="pc:endDate" content="'.$value.'" datatype="xsd:date">'.$value.'</span>';

+                break;

             case "value":

-                echo "$" . number_format(doubleval($value), 2);

+                echo '<span rel="pc:agreedPrice" typeof="gr:PriceSpecification">

+                     <span property="gr:hasCurrency" content="AUD" lang="">$ </span>

+                     <span property="gr:hasCurrencyValue" content="'.doubleval($value).'" datatype="xsd:float">' . number_format(doubleval($value), 2)

+                    .'</span></span>';

                 break;

+            case "description":

+                echo '<span property="dcterms:title">'.$value.'</span>';

             default:

                 echo str_replace("  ", "<br>", ucsmart($value));

         }

-        echo "<br>";

+        echo "<br>\n";

     }

-echo '<br><a href="https://www.tenders.gov.au/?event=public.advancedsearch.keyword&keyword=CN' . $_REQUEST['CNID'] . '"> View original record @ tenders.gov.au</a><br>';

+echo '<br><a href="https://www.tenders.gov.au/?event=public.advancedsearch.keyword&keyword=CN' . $_REQUEST['CNID'] . '"> View original record @ tenders.gov.au</a><br>

+    

+</div>';

 

 

 $query = 'SELECT * FROM heuristic_results where "CNID" = :CNID';


--- a/displaySupplier.php
+++ b/displaySupplier.php
@@ -26,7 +26,7 @@
     FROM contractnotice WHERE ' .
             $supplierQ . ' ' . $standardQ
             . ' ORDER BY value DESC';
-    echo $query;
+    
     $query = $conn->prepare($query);
 
 

directory:b/lib/amon-php (new)
--- /dev/null
+++ b/lib/amon-php

--- a/lib/common.inc.php
+++ b/lib/common.inc.php
@@ -14,6 +14,11 @@
 if (strstr($_SERVER['PHP_SELF'], "labs/")) {

     $basePath = "../";

 }

+require $basePath."lib/amon-php/amon.php";

+Amon::config(array('address'=> 'http://127.0.0.1:2464', 

+		'protocol' => 'http', 

+		'secret_key' => "JBcSUdFOi5lK0vCjLjbHDpQamcBnRA4iV7QLaTADeDQ"));

+Amon::setup_exception_handler();

 

 require ROOT . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'openid.php';

 $openid = new LightOpenID($_SERVER['HTTP_HOST']);

@@ -49,6 +54,7 @@
 function databaseError($errMsg) {

     if ($errMsg[2] != "") {

         echo '<div class="alert-message error">';

+        Amon::log(print_r($errMsg, true), array('error'));

         die(print_r($errMsg, true));

         echo "</div>";

     }

@@ -113,9 +119,28 @@
 function include_header($title) {

     global $start;

     ?>

-    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"  

-        "http://www.w3.org/TR/html4/strict.dtd"> 

-    <html>

+    <!DOCTYPE html>

+    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" version="XHTML+RDFa 1.1"

+       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

+       xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"

+       xmlns:gr="http://purl.org/goodrelations/v1#"

+       xmlns:dc="http://purl.org/dc/terms/"

+       xmlns:pc="http://purl.org/procurement#"

+       xmlns:unspsc="http://www.ksl.stanford.edu/projects/DAML/UNSPSC.daml#"

+       xmlns:xsd="http://www.w3.org/2001/XMLSchema#"

+       xmlns:pcdt="http://purl.org/procurement/public-contracts-datatypes#"

+        prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# 

+              rdfs: http://www.w3.org/2000/01/rdf-schema# 

+              gr: http://purl.org/goodrelations/v1# 

+              dcterms: http://purl.org/dc/terms/ 

+              pc: http://purl.org/procurement/public-contracts# 

+              cpv: http://purl.org/weso/pscs/cpv/2008/resource/ 

+              unspsc: http://www.ksl.stanford.edu/projects/DAML/UNSPSC.daml#

+              v: http://www.w3.org/2006/vcard/ns# 

+              payment: http://reference.data.gov.uk/def/payment# 

+              br: http://purl.org/business-register#              

+              xsd: http://www.w3.org/2001/XMLSchema# 

+              pcdt: http://purl.org/procurement/public-contracts-datatypes#">

         <head>

             <title><?php echo $title; ?> - Contract Dashboard</title>

             <link rel="stylesheet" type="text/css" href="bootstrap.min.css"> 


--- a/search_autosuggest.php
+++ b/search_autosuggest.php
@@ -47,7 +47,7 @@
         );
     }
         $query = "SELECT \"CNID\", description, value FROM contractnotice
-WHERE to_tsvector('english', description) @@ to_tsquery('english', :input)";
+WHERE to_tsvector('english', description) @@ plainto_tsquery('english', :input)";
     $query = $conn->prepare($query);
     $agencyName = $input . '%';
     $query->bindParam(":input", $input);
@@ -84,3 +84,4 @@
     echo "</results>";
 }
 ?>
+