Commit 963f5c71 authored by Tom Gordon's avatar Tom Gordon

continued work on first prototype; nearly finished

parent 780e55c9
Test
These are the source files of the argumentation tool of the
European [EAGLE](http://www.eagle-learning.eu/en) project.
......
meta:
title: Pierson v Post
citation: 3 Cai. R. 175, 2 Am. Dec. 264 (N.Y. 1805)
decided: 1805
court: Supreme Court of New York
majority: Daniel Tompkins
minority: Henry Brockholst Livingston
keywords: possession, wild animals
language: English
license: CC-BY-SA
description: >
Lodowick Post, a fox hunter, was chasing a
fox through a vacant lot when Pierson came across the fox and,
knowing it was being chased by another, killed the fox and took it
away. Post sued Pierson on an action for trespass on the case for
damages against his possession of the fox. Post argued that he had
ownership of the fox as giving chase to an animal in the course of
hunting it was sufficient to establish possession. The trial court
found in favor of Post. On appeal after the trial, the issue put to
the Supreme Court of Judicature of New York was whether one could
obtain property rights to a wild animal (Ferae naturae), in this
case the fox, by pursuit. <https://en.wikipedia.org/wiki/Pierson_v._Post>
statements:
LO=common: The land is public property.
AC=social-preference: The applicable convention for possession is a
matter of social preference.
COP=hot-pursuit: The animal was in hot pursuit.
QV=social: The quarry (animal pursued) has social value.
QLC=frequent-visitor: The quarry (animal pursued) frequently visits the land.
NOA=impolite: The act of taking the animal was impolite.
PM=altruism: The party claiming to have had possession acted altruistically.
DM=impulse: The party denying the possession claim acted impulsively.
DR=solely-responsible: The party denying the possession claim was solely responsible for his actions.
possession: The party claiming possession did have possession.
no-possession: The party claiming possession did not have possession.
issues:
i1:
meta:
keywords: possession, wild animals
positions: [possession, no-possession]
arguments:
a1:
conclusion: possession
scheme: possession-scheme
premises:
- LO=common
- AC=social-preference
- COP=hot-pursuit
- QV=social
- QLC=frequent-visitor
- NOA=impolite
- DM=impulse
- DR=solely-responsible
- PM=altruism
a2:
conclusion: no-possession
scheme: no-possession-scheme
premises:
- LO=common
- AC=social-preference
- COP=hot-pursuit
- QV=social
- QLC=frequent-visitor
- NOA=impolite
- DM=impulse
- DR=solely-responsible
- PM=altruism
assumptions:
- LO=common
- AC=social-preference
- COP=hot-pursuit
- QV=social
- QLC=frequent-visitor
- NOA=impolite
- DM=impulse
- DR=solely-responsible
- PM=altruism
\ No newline at end of file
{
"_id": "8a57ef6f-691b-11e5-8122-001b639f006e",
"_rev": "4-d66aa0568915178a1b8e99c9a98f2312",
"meta": {
"citation": "(1707) 11 East 574; 103 ER 1127",
"court": "Queen's Bench",
"decided": "1707",
"description": "Samuel Keeble (the plaintiff) owned property called Minott’s Meadow, which \r\ncontained a pond outfitted with nets and channels in a manner used to catch \r\nlarge numbers of commercially viable ducks. This type of pond served as a \r\nsort of \"duck trap\" and was known as a decoy, unlike modern duck decoys,\r\nwhich are merely fake ducks used to beguile this social bird. Actual \r\ntame ducks were used to lure their wild counterparts into the decoy. \r\nOn three occasions, defendant Edmund Hickeringill, while on his own \r\nland, discharged firearms toward Keeble's pond in order to scare away \r\nthe ducks. At trial, Keeble won a verdict of £20. \r\nSource: <https://en.wikipedia.org/wiki/Keeble_v_Hickeringill>\r\n\t\t\t",
"keywords": "wild animals, possession",
"language": "English",
"license": "CC-BY-SA",
"majority": "C.J. Holt",
"minority": "",
"title": "Keeble v Hickergill "
},
"issues": {
"i1": {
"meta": null,
"positions": [
"possession",
"no-possession"
],
"standard": "PE"
}
},
"statements": {
"ac-none": {
"meta": null,
"text": "ac-none",
"assumed": true,
"label": "in"
},
"certain-capture": {
"meta": null,
"text": "certain-capture",
"assumed": true,
"label": "in"
},
"dm-malice": {
"meta": null,
"text": "dm-malice",
"assumed": true,
"label": "in"
},
"dr-solely-responsible": {
"meta": null,
"text": "dr-solely-responsible",
"assumed": true,
"label": "in"
},
"frequent-visitor": {
"meta": null,
"text": "frequent-visitor",
"assumed": true,
"label": "in"
},
"market-value": {
"meta": null,
"text": "market-value",
"assumed": true,
"label": "in"
},
"no-possession": {
"meta": null,
"text": "The party claiming possession did not have possession.",
"assumed": false,
"label": "out"
},
"nuisance": {
"meta": null,
"text": "nuisance",
"assumed": true,
"label": "in"
},
"p-leasehold": {
"meta": null,
"text": "p-leasehold",
"assumed": true,
"label": "in"
},
"pm-livelihood": {
"meta": null,
"text": "pm-livelihood",
"assumed": true,
"label": "in"
},
"possession": {
"meta": null,
"text": "The party claiming possession did have possession.",
"assumed": false,
"label": "in"
}
},
"arguments": {
"a1": {
"meta": null,
"scheme": "possession-scheme",
"premises": [
"frequent-visitor",
"dm-malice",
"dr-solely-responsible",
"certain-capture",
"nuisance",
"p-leasehold",
"ac-none",
"market-value",
"pm-livelihood"
],
"conclusion": "possession",
"undercutter": "",
"weight": 0
},
"a2": {
"meta": null,
"scheme": "no-possession-scheme",
"premises": [
"frequent-visitor",
"dm-malice",
"dr-solely-responsible",
"certain-capture",
"nuisance",
"p-leasehold",
"ac-none",
"market-value",
"pm-livelihood"
],
"conclusion": "no-possession",
"undercutter": "",
"weight": 0
}
},
"references": {
}
}
\ No newline at end of file
{
"_id": "687c085c-6363-11e5-989b-001b639f006e",
"_rev": "1-2734ecc5224c597a314cd67a2e43ced3",
"meta": {
"citation": "3 Cai. R. 175, 2 Am. Dec. 264 (N.Y. 1805)",
"court": "Supreme Court of New York",
"decided": "1805",
"description": "Lodowick Post, a fox hunter, was chasing a \r\nfox through a vacant lot when Pierson came across the fox and,\r\nknowing it was being chased by another, killed the fox and took it\r\naway. Post sued Pierson on an action for trespass on the case for\r\ndamages against his possession of the fox. Post argued that he had\r\nownership of the fox as giving chase to an animal in the course of\r\nhunting it was sufficient to establish possession. The trial court\r\nfound in favor of Post. On appeal after the trial, the issue put to\r\nthe Supreme Court of Judicature of New York was whether one could\r\nobtain property rights to a wild animal (Ferae naturae), in this\r\ncase the fox, by pursuit. Source: Wikipedia\r\n\t\t\t",
"keywords": "wild animals, possession",
"language": "English",
"license": "CC-BY-SA",
"majority": "Daniel Tompkins",
"minority": "Henry Brockholst Livingston",
"title": "Pierson v Post"
},
"issues": {
"i1": {
"meta": null,
"positions": [
"possession",
"no-possession"
],
"standard": "PE"
}
},
"statements": {
"dm-livelihood": {
"meta": null,
"text": "dm-livelihood",
"assumed": true,
"label": "in"
},
"dr-innocent": {
"meta": null,
"text": "dr-innocent",
"assumed": true,
"label": "in"
},
"full-possession": {
"meta": null,
"text": "full-possession",
"assumed": true,
"label": "in"
},
"market-value": {
"meta": null,
"text": "market-value",
"assumed": true,
"label": "in"
},
"no-possession": {
"meta": null,
"text": "The party claiming possession did not have possession.",
"assumed": false,
"label": "out"
},
"p-freehold": {
"meta": null,
"text": "p-freehold",
"assumed": true,
"label": "in"
},
"physical-possession": {
"meta": null,
"text": "physical-possession",
"assumed": true,
"label": "in"
},
"pm-livelihood": {
"meta": null,
"text": "pm-livelihood",
"assumed": true,
"label": "in"
},
"possession": {
"meta": null,
"text": "The party claiming possession did have possession.",
"assumed": false,
"label": "in"
},
"resident": {
"meta": null,
"text": "resident",
"assumed": true,
"label": "in"
},
"violently-illegal": {
"meta": null,
"text": "violently-illegal",
"assumed": true,
"label": "in"
}
},
"arguments": {
"a1": {
"meta": null,
"scheme": "possession-scheme",
"premises": [
"full-possession",
"physical-possession",
"market-value",
"dm-livelihood",
"p-freehold",
"violently-illegal",
"pm-livelihood",
"dr-innocent",
"resident"
],
"conclusion": "possession",
"undercutter": "",
"weight": 0
},
"a2": {
"meta": null,
"scheme": "no-possession-scheme",
"premises": [
"full-possession",
"physical-possession",
"market-value",
"dm-livelihood",
"p-freehold",
"violently-illegal",
"pm-livelihood",
"dr-innocent",
"resident"
],
"conclusion": "no-possession",
"undercutter": "",
"weight": 0
}
},
"references": {
}
}
\ No newline at end of file
meta:
title: Pierson v Post
citation: 3 Cai. R. 175, 2 Am. Dec. 264[1] (N.Y. 1805)
decided: 1805
court: Supreme Court of New York
majority: Daniel Tompkins
minority: Henry Brockholst Livingston
keywords: possession, wild animals
language: English
license: CC-BY-SA
description: >
Lodowick Post, a fox hunter, was chasing a
fox through a vacant lot when Pierson came across the fox and,
knowing it was being chased by another, killed the fox and took it
away. Post sued Pierson on an action for trespass on the case for
damages against his possession of the fox. Post argued that he had
ownership of the fox as giving chase to an animal in the course of
hunting it was sufficient to establish possession. The trial court
found in favor of Post. On appeal after the trial, the issue put to
the Supreme Court of Judicature of New York was whether one could
obtain property rights to a wild animal (Ferae naturae), in this
case the fox, by pursuit. <https://en.wikipedia.org/wiki/Pierson_v._Post>
statements:
LO=common: The land is public property.
AC=social-preference: The applicable convention for possession is a
matter of social preference.
COP=hot-pursuit: The animal was in hot pursuit.
QV=social: The quarry (animal pursued) has social value.
QLC=frequent-visitor: The quarry (animal pursued) frequently visits the land.
NOA=impolite: The act of taking the animal was impolite.
PM=altruism: The party claiming to have had possession acted altruistically.
DM=impulse: The party denying the possession claim acted impulsively.
DR=solely-responsible: The party denying the possession claim was solely responsible for his actions.
possession: The party claiming possession did have possession.
no-possession: The party claiming possession did not have possession.
issues:
i1:
meta:
keywords: possession, wild animals
positions: [possession, no-possession]
arguments:
a1:
conclusion: possession
scheme: possession
premises:
- LO=common
- AC=social-preference
- COP=hot-pursuit
- QV=social
- QLC=frequent-visitor
- NOA=impolite
- DM=impulse
- DR=solely-responsible
- PM=altruism
a2:
conclusion: no-possession
scheme: no-possession
premises:
- LO=common
- AC=social-preference
- COP=hot-pursuit
- QV=social
- QLC=frequent-visitor
- NOA=impolite
- DM=impulse
- DR=solely-responsible
- PM=altruism
assumptions:
- LO=common
- AC=social-preference
- COP=hot-pursuit
- QV=social
- QLC=frequent-visitor
- NOA=impolite
- DM=impulse
- DR=solely-responsible
- PM=altruism
\ No newline at end of file
// Copyright © 2015 Thomas F. Gordon
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain one
// at http://mozilla.org/MPL/2.0/.
// Domain model of the dimensions of wild animals possession cases
package animals
import "git.list.lu/eagle/argumentation-tool/internal/domain"
var AnimalsModel = domain.DomainModel{
Name: "Possession of Wild Animals",
Description: "Model of the dimensions of wild animal property cases",
Issue: []string{"possession", "no-possession"},
Statements: make(map[string]string),
Dimensions: map[string]*domain.Dimension{
"LO": &domain.Dimension{
Description: "Land Ownership",
Factors: []string{"p-freehold", "p-leasehold", "p-rent", "common", "other-owner", "d-rent", "d-leasehold", "d-freehold"},
Default: "common",
},
"AC": &domain.Dimension{
Description: "Applicable Convention",
Factors: []string{"full-possession", "informal-excluse-right", "social-preference", "none"},
Default: "none",
},
"COP": &domain.Dimension{
Description: "Closeness of Pursuit",
Factors: []string{"physical-possession", "mortal-wounding", "certain-capture", "hot-pursuit", "chasing", "started-pursuit", "none"},
Default: "none",
},
"QV": &domain.Dimension{
Description: "Quarry Value",
Factors: []string{"market-value", "social-value", "domestic-pet", "personal-value", "none"},
Default: "none",
},
"QLC": &domain.Dimension{
Description: "Quarry Land Connection",
Factors: []string{"resident", "frequent-visitor", "regular-visitor", "occasional-visitor", "transient", "once-only"},
Default: "occasional-visitor",
},
"NOA": &domain.Dimension{
Description: "Nature of Act",
Factors: []string{"violently-illegal", "illegal", "nuisance", "impolite", "act-ok"},
Default: "act-ok",
},
"PM": &domain.Dimension{
Description: "Motive of Party Claiming Possession",
Factors: []string{"pm-livelihood", "pm-opportunistic", "pm-altruism", "pm-pleasure", "pm-impulse", "pm-malice"},
Default: "pm-pleasure",
},
"DM": &domain.Dimension{
Description: "Motive of Party Denying the Possession Claim",
Factors: []string{"dm-livelihood", "dm-opportunistic", "dm-altruism", "dm-pleasure", "dm-impulse", "dm-malice"},
Default: "dm-pleasure",
},
"DR": &domain.Dimension{
Description: "Role of Party Denying the Possession Claim",
Factors: []string{"dr-innocent", "dr-jointly-responsible", "dr-ignorant-of-the-law", "dr-accident", "dr-solely-responsible"},
Default: "dr-innocent",
},
},
}
// Copyright © 2015 Thomas F. Gordon
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain one
// at http://mozilla.org/MPL/2.0/.
package main
import (
"flag"
"git.list.lu/argumentation-tool/internal/web"
"git.list.lu/eagle/argumentation-tool/internal/web"
"log"
"os"
"path/filepath"
......@@ -20,15 +26,15 @@ The -c flag ("couchdb") specifies the URL of the Couchdb server (default: http:/
var goPath = os.Getenv("GOPATH")
const defaultPort = "8080"
const defaultHttpPort = "8080"
const defaultCouchdbURL = "http://127.0.0.1:5984/"
const dbName = "cases"
var templatesDir = filepath.Join(goPath, "/src/git.list.lu/argumentation-tool/internal/web/templates/")
var templatesDir = filepath.Join(goPath, "/src/git.list.lu/eagle/argumentation-tool/internal/web/templates/")
func main() {
flags := flag.NewFlagSet("flags", flag.ContinueOnError)
httpPort := flags.String("p", defaultPort, "the port number of the web service")
httpPort := flags.String("p", defaultHttpPort, "the port number of the web service")
couchdbURL := flags.String("c", defaultCouchdbURL, "the URL of the Couchdb server")
if err := flags.Parse(os.Args[1:]); err != nil {
log.Fatal(err)
......
// Copyright © 2015 Thomas F. Gordon
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain one
// at http://mozilla.org/MPL/2.0/.
// Models of the dimensions and similarity of cases in some domain
package domain
import (
// "fmt"
"math"
)
type Dimension struct {
Description string
Factors []string // ordered set of factor ids
Default string // id of the default factor
rank map[string]float64 // The rank of each factor in the dimension
}
type DomainModel struct {
Name string
Description string
Issue []string // statement ids of the positions of the issue
Statements map[string]string // id to natural language text
Dimensions map[string]*Dimension
index map[string]string // from factor id to dimension id
initialized bool
}
// A case assigns a factor to each dimension
type Case map[string]string // dimension id to factor id
// Initialize the domain model by computing its factor index and ranking
// the factors of the dimensions
func (m *DomainModel) init() {
// compute the factor index
m.index = make(map[string]string)
for k, d := range m.Dimensions {
for _, f := range d.Factors {
m.index[f] = k
}
}
// rank the factors of each dimension
for _, d := range m.Dimensions {
d.rank = make(map[string]float64)
for i, f := range d.Factors {
d.rank[f] = float64(i)
}
}
m.initialized = true
}
// Returns the statement of the factor with the given id.
// If no statement is defined for the factor, the id is used.
func (m *DomainModel) FactorStatement(id string) string {
s, ok := m.Statements[id]
if ok {
return s
} else {
return id
}
}
// Returns the dimension id of the factor with the given id.
// The boolean flag returned is false if there is no dimension for the
// given factor in the domain model
func (m *DomainModel) FactorDimension(factorId string) (string, bool) {
if !m.initialized {
m.init()
}
d, ok := m.index[factorId]
if !ok {
return "", false
} else {
return d, true
}
}
// Checks whether the statement id is a position of the issue of the domain
// model.
func (m *DomainModel) IsPosition(sid string) bool {
result := false
for _, id := range m.Issue {
if sid == id {
result = true
}
}
return result
}
// Case similarity is measured using the geometric mean of the ordinal
// distance between the factors of the dimensions
func (m *DomainModel) Similarity(c1 Case, c2 Case) float64 {
if !m.initialized {
m.init()
}
deltas := []float64{}
for k, d := range m.Dimensions {
f1, ok1 := c1[k]
if !ok1 {
f1 = d.Default
}
f2, ok2 := c2[k]
if !ok2 {
f2 = d.Default
}
deltas = append(deltas, math.Abs(d.rank[f1]-d.rank[f2]))
}
// compute the geometric mean of the deltas
var product float64 = 1.0
for _, delta := range deltas {
// add 1 to the differences to avoid multiplying by zero
product = product * (delta + 1)
}
n := len(deltas)
return 1.0 / math.Pow(product, 1.0/float64(n))
}
{
"_id" : "_design/cases",
"views" : {
"statement" : {
"map" : "function(doc) { var l = {}; for (var s in doc.statements) { l[s] = doc.statements[s] }; emit(doc._id, { \"title\": doc.meta.title, \"decided\": doc.meta.decided, \"statements\": l }); }"
}
}
}
\ No newline at end of file
// Copyright © 2015 Thomas F. Gordon
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain one
// at http://mozilla.org/MPL/2.0/.
package web
import (
"bytes"
"encoding/json"
// "fmt"
"git.list.lu/eagle/argumentation-tool/internal/animals"
"github.com/carneades/carneades-4/src/engine/caes"
"github.com/carneades/carneades-4/src/engine/caes/encoding/dot"
cj "github.com/carneades/carneades-4/src/engine/caes/encoding/json"
......@@ -14,14 +21,6 @@ import (
"os/exec"
)
// Translate atoms to English sentences.
func toEnglish(atom string) string {
// to do
return atom
}
var dimensions = []string{"LO", "AC", "COP", "QV", "QLC", "NOA", "PM", "DM", "DR"}
func makeNewAnimalsCaseHandler(couchdbURL string, dbName string, errorTemplate *template.Template) func(w http.ResponseWriter, req *http.Request) {
return func(w http.ResponseWriter, req *http.Request) {
ag := cj.NewArgGraph()
......@@ -33,7 +32,7 @@ func makeNewAnimalsCaseHandler(couchdbURL string, dbName string, errorTemplate *
ag.Meta["minority"] = req.FormValue("minority")
ag.Meta["keywords"] = req.FormValue("keywords")
ag.Meta["language"] = req.FormValue("language")
ag.Meta["license"] = req.FormValue("license")
// ag.Meta["license"] = req.FormValue("license")
ag.Meta["description"] = req.FormValue("description")
possession := false
......@@ -49,9 +48,9 @@ func makeNewAnimalsCaseHandler(couchdbURL string, dbName string, errorTemplate *
}
// add the premises to the statement table
for _, dimension := range dimensions {
for dimension, _ := range animals.AnimalsModel.Dimensions {
ag.Statements[req.FormValue(dimension)] =
cj.Statement{Text: toEnglish(req.FormValue(dimension)),
cj.Statement{Text: animals.AnimalsModel.FactorStatement(req.FormValue(dimension)),
Assumed: true,
Label: "in"}
}
......