Congestion charge: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(headings added)
(codes combined)
Line 14: Line 14:




== Add a discussion item ==
=== Add a discussion item, relation, or evaluation ===


<rcode name="add_item" embed=1 label="Add an item" showcode=-1 variables="
<rcode name="add" embed=1 label="Add a thing" showcode=-1 variables="
name:item|description:The item you want to add|type:textbox|
name:thing|description:What kind of thing are you adding?|type:selection|options:
name:name|description:A short name for the item|type:text|
'Items';Item;
name:type|description:Is this a value of factual statement?|type:selection|options:
'Relations';Relation;
'Evaluations';Evaluation|
name:name|description:A short name for the thing|type:text|
name:description|description:A description of the thing|type:textbox|
name:type|description:Is this a value or factual statement?|type:selection|options:
'Value';Value statement;'Fact';Factual statement;'I don't know';I don't know|
'Value';Value statement;'Fact';Factual statement;'I don't know';I don't know|
name:pagename|type:hidden|default:'{{PAGENAME}}'|
category:Item|
name:ident|type:hidden|default:'Op_en{{PAGEID}}'
category_conditions:thing;'Items'|
">
library(OpasnetUtils)
 
obs <- tryCatch(
opbase.data(ident, subset = "Items"),
error = function(...) return(NULL)
)
 
if (!is.null(obs)) {
if ("Obs" %in% colnames(obs)) {
at <- "replace"
obs <- 1
} else {
at <- "append"
obs <- obs$ID
obs <- gsub("[A-Za-z]", "", as.character(obs))
obs <- max(as.integer(obs)) + 1
}
} else {
at <- "replace"
obs <- 1
}
dat <- data.frame(
ID = obs,
Timestamp = date(),
User = wiki_username,
Type = type,
Item = item,
Result = name
)
oprint(dat)
 
opbase.upload(
dat,
ident = ident,
name = pagename,
subset = "Items",
act_type = at,
language = "eng",
who = wiki_username
)
 
if (at == "replace") {
dat <- data.frame(
Timestamp = date(),
User = wiki_username,
Reason = "Initiation",
Result = "NA"
)
opbase.upload(
dat,
ident = ident,
name = pagename,
subset = "Itemremoves",
act_type = at,
language = "eng",
who = wiki_username
)
}
cat("Your item has been successfully saved.\n")
</rcode>
 
== Add a relation ==
 
<rcode name="add_relation" embed=1 label="Add a relation" showcode=-1 variables="
name:subject|description:The ID of the subject in the relation|type:text|
name:subject|description:The ID of the subject in the relation|type:text|
category:Relation|
category_conditions:thing;'Relations'|
name:predicate|description:What is the relation (predicate)?|type:selection|options:
name:predicate|description:What is the relation (predicate)?|type:selection|options:
'connects';connects with (by some non-specified way);
'connects';connects with (by some non-specified way);
Line 95: Line 36:
'subclass of';is a subclass of class|
'subclass of';is a subclass of class|
name:object|description:The ID of the object in the relation|type:text|
name:object|description:The ID of the object in the relation|type:text|
name:name|description:A short name for the relation|type:text|
name:type|description:Is the truth value for an item or a relation?|type:selection|options:
'Item';For an item;'Relation';For a relation|
category:Evaluation|
category_conditions:thing;'Evaluations'|
name:subject|description:The ID of the item or relation you want to evaluate|type:text|
name:evaluation|description:Is the item or relation true?|type:selection|options:
'True';It is true;'Maybe';It is maybe true;'False';It is false|
name:pagename|type:hidden|default:'{{PAGENAME}}'|
name:pagename|type:hidden|default:'{{PAGENAME}}'|
name:ident|type:hidden|default:'Op_en{{PAGEID}}'
name:ident|type:hidden|default:'Op_en{{PAGEID}}'
Line 102: Line 49:


obs <- tryCatch(
obs <- tryCatch(
opbase.data(ident, subset = "Relations"),  
opbase.data(ident, subset = thing),  
error = function(...) return(NULL)
error = function(...) return(NULL)
)
)
Line 112: Line 59:
} else {
} else {
at <- "append"
at <- "append"
obs <- obs$Rel_ID
obs <- obs$ID
obs <- gsub("[A-Za-z]", "", as.character(obs))
obs <- gsub("[A-Za-z]", "", as.character(obs))
obs <- max(as.integer(obs)) + 1
obs <- max(as.integer(obs)) + 1
Line 120: Line 67:
obs <- 1
obs <- 1
}
}
at <- "replace"
obs <- 1
dat <- data.frame(
dat <- data.frame(
Rel_ID = obs,
ID = obs,
Timestamp = date(),  
Timestamp = date(),  
User = wiki_username,
User = wiki_username,
Subject = subject,
Description = description
Predicate = predicate,
Object = object,
Result = name
)
)
oprint(dat)


opbase.upload(
if(thing == "Items") {
dat,
dat <- cbind(dat, data.frame(
ident = ident,
Type = type,
name = pagename,
Result = name
subset = "Relations",
))
act_type = at,  
}
language = "eng",  
who = wiki_username
)


if (at == "replace") {
if(thing == "Relations") {
dat <- data.frame(
dat <- cbind(dat, data.frame(
Timestamp = date(),  
Subject = subject,
User = wiki_username,
Predicate = predicate,  
Reason = "Initiation",  
Object = object,
Result = "NA"
Result = name
)
))
opbase.upload(
dat,
ident = ident,
name = pagename,
subset = "Relationremoves",
act_type = at,
language = "eng",
who = wiki_username
)
}
}
cat("Your relation has been successfully saved.\n")
if(thing == "Evaluations") {
</rcode>
dat <- cbind(dat, data.frame(
 
Thing = type,
== Evaluate an item or relation for its truth value ==
Subject = subject,
 
Evaluation = evaluation,
<rcode name="add_tru" embed=1 label="Add a truth value" showcode=-1 variables="
Result = name
name:type|description:Is the truth value for an item or a relation?|type:selection|options:
))
'Item';For an item;'Relation';For a relation|
name:object|description:The ID of the item or relation you want to evaluate|type:text|
name:description|description:A short description for the evaluation|type:textbox|
name:evaluation|description:Is the item or relation true?|type:selection|options:
'True';It is true;'Maybe';It is maybe true;'False';It is false|
name:pagename|type:hidden|default:'{{PAGENAME}}'|
name:ident|type:hidden|default:'Op_en{{PAGEID}}'
">
library(OpasnetUtils)
 
obs <- tryCatch(
opbase.data(ident, subset = "Evaluations"),  
error = function(...) return(NULL)
)
oprint(obs)
if (!is.null(obs)) {
if ("Obs" %in% colnames(obs)) {
at <- "replace"
obs <- 1
} else {
at <- "append"
obs <- obs$Eva_ID
obs <- gsub("[A-Za-z]", "", as.character(obs))
obs <- max(as.integer(obs)) + 1
}
} else {
at <- "replace"
obs <- 1
}
}
dat <- data.frame(
Eva_ID = obs,
Timestamp = date(),
User = wiki_username,
Type = type,
Object = object,
Description = description,
Result = evaluation
)
oprint(dat)
oprint(dat)


Line 209: Line 106:
ident = ident,  
ident = ident,  
name = pagename,  
name = pagename,  
subset = "Evaluations",  
subset = thing,  
act_type = at,  
act_type = at,  
language = "eng",  
language = "eng",  
Line 215: Line 112:
)
)


if (at == "replace") {
# IF YOU HAVE TO EMPTY THE REMOVED THINGS, YOU HAVE TO DO IT BY HAND WITH THIS CODE
if (FALSE) {
dat <- data.frame(
dat <- data.frame(
Timestamp = date(),  
Timestamp = date(),  
User = wiki_username,
User = wiki_username,
Reason = "Initiation",  
Reason = "Initiation",  
Thing = thing,
Result = "NA"
Result = "NA"
)
)
Line 226: Line 125:
ident = ident,  
ident = ident,  
name = pagename,  
name = pagename,  
subset = "Evaluationremoves",  
subset = "Removes",  
act_type = at,  
act_type = at,  
language = "eng",  
language = "eng",  
Line 232: Line 131:
)
)
}
}
cat("Your evaluation has been successfully saved.\n")
cat("Your item has been successfully saved.\n")
</rcode>
</rcode>


----
----
;<span id="Items">Current discussion items.</span>
;<span id="Show">Current discussion things.</span>


<rcode name="show_item" label="Show items" embed=1 showcode=-1 variables="
<rcode name="show" label="Show discussion things" embed=1 showcode=-1 variables="
name:thing|description:What kind of things do you want to see?|type:selection|options:
'Items';Item;
'Relations';Relation;
'Evaluations';Evaluation|
name:ident|type:hidden|default:'Op_en{{PAGEID}}'|
name:ident|type:hidden|default:'Op_en{{PAGEID}}'|
name:pagename|type:hidden|default:'{{PAGENAME}}'
name:pagename|type:hidden|default:'{{PAGENAME}}'
Line 246: Line 150:
pagename <- gsub(" ", "_", pagename)
pagename <- gsub(" ", "_", pagename)
dat <- tryCatch(
dat <- tryCatch(
opbase.data(ident, subset = "Items"),  
opbase.data(ident, subset = thing),  
error = function(...) return(NULL)
error = function(...) return(NULL)
)
)


if (is.null(dat)) oprint("No items were found") else {
if (is.null(dat)) oprint("No things were found") else {
poistot <- tryCatch(
poistot <- tryCatch(
opbase.data(ident, subset = "Itemremoves"),  
opbase.data(ident, subset = "Removes"),  
error = function(...) return(NULL)
error = function(...) return(NULL)
)
)
if (!is.null(poistot)) dat <- dat[!dat$ID %in% poistot$Result, ]
if (!is.null(poistot)) dat <- dat[!dat$ID %in% poistot$Result[poistot$Thing == thing] , ]
if(nrow(dat) == 0) {
if(nrow(dat) == 0) {
Line 265: Line 169:
}
}
</rcode>
</rcode>
;<span id="Items">Current discussion relations.</span>
<rcode name="show_relation" label="Show relations" embed=1 showcode=-1 variables="
name:ident|type:hidden|default:'Op_en{{PAGEID}}'|
name:pagename|type:hidden|default:'{{PAGENAME}}'
">
library(OpasnetUtils)
pagename <- gsub(" ", "_", pagename)
dat <- tryCatch(
opbase.data(ident, subset = "Relations"),
error = function(...) return(NULL)
)
if (is.null(dat)) oprint("No relations were found") else {
poistot <- tryCatch(
opbase.data(ident, subset = "Relationremoves"),
error = function(...) return(NULL)
)
if (!is.null(poistot)) dat <- dat[!dat$Rel_ID %in% poistot$Result, ]
if(nrow(dat) == 0) {
oprint("No relations to show.")
} else {
oprint(dat, include.rownames = FALSE)
}
}
</rcode>
;<span id="Evaluations">Current evaluations.</span>


<rcode name="show_evaluation" label="Show evaluations" embed=1 showcode=-1 variables="
name:ident|type:hidden|default:'Op_en{{PAGEID}}'|
name:pagename|type:hidden|default:'{{PAGENAME}}'
">
library(OpasnetUtils)
pagename <- gsub(" ", "_", pagename)
dat <- tryCatch(
opbase.data(ident, subset = "Evaluations"),
error = function(...) return(NULL)
)
if (is.null(dat)) oprint("No evaluations were found") else {
poistot <- tryCatch(
opbase.data(ident, subset = "Evaluationremoves"),
error = function(...) return(NULL)
)
if (!is.null(poistot)) dat <- dat[!dat$Eva_ID %in% poistot$Result, ]
if(nrow(dat) == 0) {
oprint("No evaluations to show.")
} else {
oprint(dat, include.rownames = FALSE)
}
}
</rcode>
{{hidden|
{{hidden|
'''Items to be removed'''
'''Items to be removed'''


<rcode name="remove_item" embed=1 label="Remove item" showcode=-1 variables="
<rcode name="remove" embed=1 label="Remove a thing" showcode=-1 variables="
name:id|description:ID of the item to be removed|type:text|
name:thing|description:What kind of thing are you removing?|type:selection|options:
'Items';Item;
'Relations';Relation;
'Evaluations';Evaluation|
name:id|description:ID of the thing to be removed|type:text|
name:reason|description:Reason to remove|type:selection|options:
name:reason|description:Reason to remove|type:selection|options:
;- Select reason -;
;- Select reason -;
Line 344: Line 193:
User = wiki_username,
User = wiki_username,
Reason = reason,  
Reason = reason,  
Thing = thing,
Result = id
Result = id
)
)
Line 351: Line 201:
ident = ident,  
ident = ident,  
name = pagename,  
name = pagename,  
subset = "Itemremoves",  
subset = "Removes",  
act_type = "append",  
act_type = "append",  
language = "eng",
language = "eng",
Line 357: Line 207:
)
)


oprint("The item has been successfully removed.\n")
oprint("The thing has been successfully removed.\n")


pois <- opbase.data(ident, subset = "Items")
pois <- opbase.data(ident, subset = thing)


oprint(pois[pois$ID == id , ], include.rownames = FALSE)
oprint(pois[pois$ID == id & pois$Thing == thing , ], include.rownames = FALSE)


</rcode>
</rcode>
}}
}}
# These t2bs are just to remove redundant tables from the Base view.
<t2b name="Itemremoves" index="A" obs="R" unit="-">
A|1
</t2b>
<t2b name="Relationremoves" index="A" obs="R" unit="-">
A|1
</t2b>
<t2b name="Evaluationremoves" index="A" obs="R" unit="-">
A|1
</t2b>

Revision as of 10:14, 6 April 2017



Question

What reasons are there for implementing or not implementing a congestion charging system in a city? What values and combinations of values result in which combination?

Answer

Not found yet.

Rationale

Add a discussion item, relation, or evaluation

What kind of thing are you adding?:

A short name for the thing:

A description of the thing:

Item

Is this a value or factual statement?:

Relation

The ID of the subject in the relation:

What is the relation (predicate)?:

The ID of the object in the relation:

Evaluation

Is the truth value for an item or a relation?:

The ID of the item or relation you want to evaluate:

Is the item or relation true?:



Current discussion things.

What kind of things do you want to see?:



  1. These t2bs are just to remove redundant tables from the Base view.
Itemremoves(-)
ObsAR
1A1


Relationremoves(-)
ObsAR
1A1


Evaluationremoves(-)
ObsAR
1A1