Add beginnings of public contract ontology
Add beginnings of public contract ontology

--- a/admin/neo4jimporter/src/main/java/Importer.java
+++ b/admin/neo4jimporter/src/main/java/Importer.java
@@ -79,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/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/lib/common.inc.php
+++ b/lib/common.inc.php
@@ -113,9 +113,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">