Commit 8d994feb authored by Tom Gordon's avatar Tom Gordon

completed the new case user story.

parent 80bd2e0e
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
tfgordon@tgo-5114.8678:1442820980
\ 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
package main
import (
"flag"
"git.list.lu/argumentation-tool/internal/web"
"log"
"os"
"path/filepath"
)
const help = `
usage: eagle-argumentation-tool [-p port] [-s couchdb-url]
Starts the Eagle argumentation tool as a web service.
The -p flag ("port") specifies the port to use for the web service (default: 8080)
The -c flag ("couchdb") specifies the URL of the Couchdb server (default: http://127.0.0.1:5984/)
`
var goPath = os.Getenv("GOPATH")
const defaultPort = "8080"
const defaultCouchdbURL = "http://127.0.0.1:5984/"
var templatesDir = filepath.Join(goPath, "/src/git.list.lu/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")
couchdbURL := flags.String("c", defaultCouchdbURL, "the URL of the Couchdb server")
if err := flags.Parse(os.Args[1:]); err != nil {
log.Fatal(err)
}
web.ArgumentationToolServer(*httpPort, *couchdbURL, templatesDir)
}
package web
import (
"bytes"
"encoding/json"
// "fmt"
"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"
"github.com/pborman/uuid"
"html/template"
"io/ioutil"
"net/http"
"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"}
const dbName = "cases"
func makeNewAnimalsCaseHandler(couchdbURL string, errorTemplate *template.Template) func(w http.ResponseWriter, req *http.Request) {
return func(w http.ResponseWriter, req *http.Request) {
ag := cj.NewArgGraph()
ag.Meta["title"] = req.FormValue("title")
ag.Meta["citation"] = req.FormValue("citation")
ag.Meta["decided"] = req.FormValue("decided")
ag.Meta["court"] = req.FormValue("court")
ag.Meta["majority"] = req.FormValue("majority")
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["description"] = req.FormValue("description")
possession := false
if req.FormValue("decision") == "possession" {
possession = true
}
possessionLabel := "out"
noPossessionLabel := "in"
if possession {
possessionLabel = "in"
noPossessionLabel = "out"
}
// add the premises to the statement table
for _, dimension := range dimensions {
ag.Statements[req.FormValue(dimension)] =
cj.Statement{Text: toEnglish(req.FormValue(dimension)),
Assumed: true,
Label: "in"}
}
// take note of the premises, which are all the statements
// add thus far to the statements table
premises := []interface{}{}
for k, _ := range ag.Statements {
premises = append(premises, k)
}
// add the conclusions of the arguments, constructed next below,
// to the statements table
ag.Statements["possession"] = cj.Statement{
Text: "The party claiming possession did have possession.",
Label: possessionLabel,
}
ag.Statements["no-possession"] = cj.Statement{
Text: "The party claiming possession did not have possession.",
Label: noPossessionLabel,
}
ag.Arguments["a1"] = cj.Argument{
Scheme: "possession-scheme",
Premises: []interface{}(premises),
Conclusion: "possession",
}
ag.Arguments["a2"] = cj.Argument{
Scheme: "no-possession-scheme",
Premises: []interface{}(premises),
Conclusion: "no-possession",
}
// construct the issue
ag.Issues["i1"] = cj.Issue{
Positions: []string{"possession", "no-possession"},
Standard: "PE",
}
// upload the JSON document to Couchdb
id := uuid.NewUUID().String()
req2, err := http.NewRequest("PUT", couchdbURL+dbName+"/"+id, bytes.NewBufferString(ag.String()))
if err != nil {
errorTemplate.Execute(w, err.Error())
return
}
client := http.Client{}
resp, err := client.Do(req2)
if err != nil {
errorTemplate.Execute(w, err.Error())
return
}
defer resp.Body.Close()
m := make(map[string]interface{})
v, err := ioutil.ReadAll(resp.Body)
if err != nil {
errorTemplate.Execute(w, err.Error())
return
}
err = json.Unmarshal(v, &m)
if err != nil {
errorTemplate.Execute(w, err.Error())
return
}
// m should have the form:
// {"ok":true,"id":"6e1295ed6c29495e54cc05947f18c8af","rev":"1-2902191555"}
// Provide the user with feedback by displaying an
// argument map, in SVG formt, for the argument graph of the
// case entered. To validate that the graph has been correctly
// stored in Couchdb, first read the JSON back in
// from the Couchdb repository.
resp, err = http.Get(couchdbURL + dbName + "/" + id)
defer resp.Body.Close()
var data []byte
data, err = ioutil.ReadAll(resp.Body)
if err != nil {
errorTemplate.Execute(w, err.Error())
return
}
var cag *caes.ArgGraph
rd := bytes.NewReader(data)
cag, err = cj.Import(rd)
if err != nil {
errorTemplate.Execute(w, err.Error())
return
}
cmd := exec.Command("dot", "-Tsvg")
w2 := bytes.NewBuffer([]byte{})
cmd.Stdin = w2
cmd.Stdout = w
err = dot.Export(w2, *cag)
if err != nil {
errorTemplate.Execute(w, err.Error())
return
}
err = cmd.Run()
if err != nil {
errorTemplate.Execute(w, err.Error())
return
}
}
}
<!DOCTYPE html>
<html>
<head>
<title>EAGLE Argumentation Tool</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page" id="mainPage">
<div data-role="header">
<h1>EAGLE Argumentation Tool</h1>
</div>
<ul data-role="listview" data-inset="true">
<li><a href="/new-animals-case-form">Enter a new case about the possession of wild animals.</a></li>
<li><a href="/search-animals-cases-form">Search for cases about the possession of wild animals. </a></li>
</ul>
<div data-role="footer" data-id="main-footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="/" class="ui-btn-active" data-icon="home">Home</a></li>
<li><a href="/help" data-icon="info">Help</a></li>
<li><a href="/imprint" data-icon="info">Imprint</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Error Message</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page" id="errorPage">
<div data-role="header">
<h1>Error Message</h1>
</div>
<p>
{{.}}
</p>
<div data-role="footer" data-id="main-footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="/" class="ui-btn-active" data-icon="home">Home</a></li>
<li><a href="help.html" data-icon="info">Help</a></li>
<li><a href="/imprint" data-icon="info">Imprint</a></li>
</ul>
</div>
</div>
</div> <!-- error page -->
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>EAGLE Argumentation Tool Help</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page" id="HelpPage">
<div data-role="header">
<h1>EAGLE Argumentation Tool - Help Page</h1>
</div>
<div role="main" class="ui-content">
<p>To be written.</p>
<div data-role="footer" data-id="main-footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="/" class="ui-btn-active" data-icon="home">Home</a></li>
<li><a href="/help" data-icon="info">Help</a></li>
<li><a href="/imprint" data-icon="info">Imprint</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>EAGLE Argumentation Tool Imprint</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page" id="ImprintPage">
<div data-role="header">
<h1>Imprint</h1>
</div>
<div role="main" class="ui-content">
<h2>Publishing Notes</h2>
<p>The Fraunhofer Institute for Open Communication Systems<br/>
Kaiserin-Augusta-Allee 31<br/>
Berlin 10589<br/>
Germany</p>
<p>is a constituent entity of the Fraunhofer-Gesellschaft, and as such has no separate legal status.</p>
<p>Fraunhofer-Gesellschaft <br/>
zur Förderung der angewandten Forschung e.V.<br/>
Hansastraße 27 c<br/>
80686 München<br/>
Phone: +49 89 1205- 0<br/>
Fax: +49 89 1205-7531 <br/>
www.fraunhofer.de<br/>
</p>
<p>VAT Identification Number in accordance with §27 a VAT Tax Act: DE 129515865</p>
<h3>Court of jurisdiction</h3>
<p>Amtsgericht München (district court)<br/>
Registered nonprofit association <br/>
Registration no. VR 4461</p>
<h3>Responsible editor</h3>
<p>
Prof. Dr. Thomas F. Gordon<br/>
thomas.gordon@fokus.fraunhofer.de
</p>
<h3>Executive Board</h3>
<ul>
<li>Prof. Dr.-Ing. Reimund Neugebauer, President, Corporate Policy and Research Management</li>
<li>Prof. Dr.-Ing. Alexander Verl, Technology Marketing and Business Models</li>
<li>Prof. Dr. Alexander Kurz, Human Resources, Legal Affairs and IP Management</li>
<li>Prof. (Univ. Stellenbosch) Dr. Alfred Gossner, Finance, Controlling(incl. Business Administration, Purchasing and Real Estate) and Information Systems</li>
</ul>
<h3>Usage Rights</h3>
<p>Copyright © by<br/>
Fraunhofer-Gesellschaft<br/>
All rights reserved. <br/>
All copyright for this Web site are owned in full by the Fraunhofer-Gesellschaft.
</p>
<p>Permission is granted to download or print material published on this site for personal use only. Its use for any other purpose, and in particular its commercial use or distribution, are strictly forbidden in the absence of prior written approval. Please address your requests for approval to:</p>
<p>The Fraunhofer Institute for Open Communication Systems<br/>
Kaiserin-Augusta-Allee 31<br/>
Berlin 10589<br/>
Germany</p>
<p>Notwithstanding this requirement, material may be downloaded or printed for use in connection with press reports on the activities of the Fraunhofer-Gesellschaft and its constituent institutes, on condition that the following terms are complied with:</p>
<p>No alterations may be made to pictorial content, with the exception of framing modifications to emphasize the central motif. The source must be quoted and two free reference copies must be sent to the above-mentioned address. Such usage is free of charge.</p>
<h3>Disclaimer</h3>
<p>We cannot assume any liability for the content of external pages. Solely the operators of those linked pages are responsible for their content.
We make every reasonable effort to ensure that the content of this Web site is kept up to date, and that it is accurate and complete. Nevertheless, the possibility of errors cannot be entirely ruled out. We do not give any warranty in respect of the timeliness, accuracy or completeness of material published on this Web site, and disclaim all liability for (material or non-material) loss or damage incurred by third parties arising from the use of content obtained from the Web site.
Registered trademarks and proprietary names, and copyrighted text and images, are not generally indicated as such on our Web pages. But the absence of such indications in no way implies that these names, images or text belong to the public domain in the context of trademark or copyright law.</p>
<div data-role="footer" data-id="main-footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="/" class="ui-btn-active" data-icon="home">Home</a></li>
<li><a href="/help" data-icon="info">Help</a></li>
<li><a href="/imprint" data-icon="info">Imprint</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
This diff is collapsed.
package web
import (
"html/template"
"log"
"net/http"
"path/filepath"
"sync"
)
type templateHandler struct {
once sync.Once
filename string
templatesDir string
templ *template.Template
}
func (t *templateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
t.once.Do(func() {
t.templ = template.Must(template.ParseFiles(filepath.Join(t.templatesDir, t.filename)))
})
t.templ.Execute(w, nil)
}
func ArgumentationToolServer(httpPort string, couchdbURL string, templatesDir string) {
var errorTemplate = template.Must(template.ParseFiles(filepath.Join(templatesDir, "error.html")))
http.Handle("/", &templateHandler{filename: "argumentation-tool.html", templatesDir: templatesDir})
http.Handle("/help", &templateHandler{filename: "help.html", templatesDir: templatesDir})
http.Handle("/new-animals-case-form", &templateHandler{filename: "new-animals-case.html", templatesDir: templatesDir})
http.Handle("/search-animals-cases-form", &templateHandler{filename: "search-animals-cases.html", templatesDir: templatesDir})
http.Handle("/imprint", &templateHandler{filename: "imprint.html", templatesDir: templatesDir})
newAnimalsCaseHandler := makeNewAnimalsCaseHandler(couchdbURL, errorTemplate)
http.HandleFunc("/new-animals-case", newAnimalsCaseHandler)
// http.HandleFunc("/search-animals-cases", searchAnimalsCasesHandler)
// start the web server
if err := http.ListenAndServe(":"+httpPort, nil); err != nil {
log.Fatal("EAGLE argumentation tool: ", err)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment