1/29

An Executable Conceptual Model for Biodiversity in Planning


 Use Left/Right Cursor/Home/End
2/29

Tree Huggers

Chipko village women
in 1730, 294 Indian men and 69 women died while protecting their village trees.
Members of the Bishnois branch of Hinduism, died while trying to protect the trees in their village from being turned into the raw material for building a palace. They literally clung to the trees, while being slaughtered by the foresters. But their action led to a royal decree prohibiting the cutting of trees in any Bishnoi village. And now those villages are virtual wooded oases amidst an otherwise desert landscape.
Photo of village women of the Chipko movement (chipko means “to cling” in Hindi)) in the early 70's in the Garhwal Hills of India, protecting the trees from being cut down.
3/29

Contents

4/29

Biodiversity Net Gain : BNG

They paved paradise
And put up a parking lot
5/29

BNG Metric

6/29

BNG Metric Computation

7/29

Spreadsheets - Blessing or Curse?

8/29

Excel : Derivation

Computing the Habitat Units of a parcel
                
=IFERROR(IF(P11="","",
   IF(AND(P11=$'G-1 All Habitats'.$X$3,T11>0),U11+V11,
      IF(AND(P11=$'G-1 All Habitats'.$X$3,S11>0),U11+V11,
        IF(AND(P11=$'G-1 All Habitats'.$X$3,AC11>0),"Any Loss Unacceptable ⚠",
           IF(AND(P11=$'G-1 All Habitats'.$X$3,W11>0),"Any Loss Unacceptable ⚠",
              H11*J11*L11*O11)
  )))),"Check Data ▲")
9/29

Excel : Table check

Fairly conditions are those need further evidence
                
=IF(OR(K11:K258="Fairly Good",K11:K258="Fairly Poor"),
   "A 'Fairly Category has been used -
       check evidence to ensure this is appropriate ",
   "")
One of the summary cells in the Habitat_Baseline table
10/29

The challenge

Is there an alternative to this spreadsheet which would:
11/29

Complexity

Tony Hoare, Computer Scientist
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.
Tony Hoare 1980
Apart from Quicksort, CSP and Z, Tony implemented Algol 60 for Elliott Brothers which I used on the NZ Met Office's Elliot 503 and was a close friend of my mentor and employer for a few years, Michael Jackson.
Legislators and administrators would do well to heed this insight too.
12/29

Data Modeling

13/29

Object modeling

14/29

Part of the main BNG data model: Bristol Zoo

Boxes are Entities   immutable   user input   summary   [nnn] is the cardinality of the Tables   Lines are dependencies  

Part of BNG ER diagram
15/29

EARX : Simplifying assumptions

16/29

EARX : Executable Data Model

17/29

XQuery : Condition Lookup

table('Habitat_Condition')
       [Habitat=$self/Habitat]
        /Condition         
18/29

XQuery : Calculate Habitat Units

$self/Area 
  * $self/Distinctiveness_Score 
  * $self/Habitat_Condition_Score 
  * $self/Strategic_significance_multiplier 
  * $self/Spatial_Risk_Multiplier
19/29

XQuery : Fairly condition

<attribute name="Fairly_Check" type="string">
   <description>see User Guide 5.3.6</description>
   <derivation>
      <code>
if (some $condition in table('Habitat_Baseline')/Habitat_Condition 
    satisfies starts-with($condition,"Fairly")) 
then "Warning -  ..." 
else "OK -  ..."
     </code>
   </derivation>
</attribute>
Where to place this ?
20/29

Challenges and Opportunities

21/29

Computation

The core feature of a spreadsheet is the computation algorithm.
  1. repeatedly recalculate top down, left to right until nothing changes (Visicalc 1979)
  2. construct a dependency graph to determine order of cell evaluation, recalc all (LANPAR 1969 Forward Referencing/Natural Order Calculation)
  3. recalc only the affected cells on change (Modern spreadsheets?)
22/29

EARX : computing an Entity Instance

23/29

Topological sorting

declare function md:topological-sort(
       $unordered as element(dependency)*,
       $ordered as as element(dependency)* ) 
       as element(dependency)* {
   if (empty($unordered)) 
   then $ordered
   else
      let $dependencies := 
             $unordered [every $name in require
                        satisfies $name = $ordered/@name]
      return 
        if ($dependencies)
        then md:topological-sort(
                $unordered except $dependencies,
                ($ordered, $dependencies ) 
             )
       else ...
};
This algorithm needs a workaround in eXist-db due to a bug
When looking for an algorithm for topological sorting, I asked Chat-GTP (Bard) for an algorithm in XQuery. It came back with syntacticlly correct but not functional code, even after several challenges. Giving up on AI, I did a basic search and the first result was an algorithm I had written in the XQuery wikibook 15 years ago.
24/29

Development Work to do

The aim is to construct an executable, informative specification more than a production tool.
25/29

Algorithmic Transparency

26/29

Legislation and Climate change

27/29
Elms in Amsterdam, near the Rijksmuseum
They took all the trees
Put 'em in a tree museum
28/29

Links

29/29

Index