Rigorous and Reliable (RAR)

Full Version: procone.py -- OMUD
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

zhihao

procone.py is used for generating analysis result for one case.

在某一案例内容中搜索key{1,2,3},构建"keys": []。
Code:
main() {
    set $tycajson_pfn as a insert.json
    get $reqtype from $tycajson_pfn
    switch ($reqtype) {
        case "delete":
            deleteIfMatch()
        case "select"
            selectIfMatch()
        deault:
            query()
    }
}

deleteIfMatch()
Code:
casecnt: current case count
biboext: $bibo_share/bibo-ext.pcf , records current case count
tycajson_pfn: file of json cases
blank_json: the value of is {"opstatus":"deleted"}
deleteIfMatch() {
    rr=0
    if $reqcaseid matches $caseid{
        rid --insitu $tycajson_pfn
        create file $tycajson_pfn with $blank_json
        
        pcf --pcf $biboext --add bibo_doc_cnt ${casecnt}+1
        coolauntie rm $tycano
        rr = 105
    }
    return rr
}

selectIfMatch()
Code:
tycajson_pfn: file of json cases
reqcaseid: reqest case id
caseid: id of existing case
tycano: case number it selects

selectIfMatch() {
    if $reqcaseid matches $caseid
        return tycano
}

query()
Code:
query() {
    generate query response
}

delete_one_case():
Code:
fw: file handler of one result file
newftexts: request content
insblock: content of insert block of the case in the corpus
blank_json: the value of is {"opstatus":"deleted"}
delete_one_case(fw, newftexts, insblock){
  caseid = get caseid from insblock
  newcaseid = get caseid from newftexts
  if ($caseid  == $newcaseid){
    write $blank_json to $fw
  }
}

---
20210813/zhihao: update blank_json
20210811/zhihao: add selectIfMatch
20210811/zhihao: add delete_one_case
20200926/zhihao: add switch in main()

zhihao

(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]deleteIfMatch()
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
        create file insert.json with request template which has empty value
}

根据要求修改逻辑
Quote:After the match-and-delete, we should generate a result file to report the result of the deletion. If there is no match and no deletion, the result file is a nil file -- a file with zero bytes.

设计如下:
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
        create file insert.json with request template which has empty value
        generate result file
    else
        create empty result file
}
(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]if $reqtype is "delete"
deleteIfMatch()
else
query()
}

Pls make it a switch although the implementation may use if/else

There is a branch for 'select', right?

zhihao

(09-26-2020 12:38 PM)lingu Wrote: [ -> ]
(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]if $reqtype is "delete"
deleteIfMatch()
else
query()
}

Pls make it a switch although the implementation may use if/else

There is a branch for 'select', right?

updated as follows:
Code:
switch ($reqtype) {
    case "delete":
        deleteIfMatch()
    case "select"
        selectIfMatch()
    deault:
        query()
}
(09-26-2020 04:34 PM)zhihao Wrote: [ -> ]
(09-26-2020 12:38 PM)lingu Wrote: [ -> ]
(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]if $reqtype is "delete"
deleteIfMatch()
else
query()
}

Pls make it a switch although the implementation may use if/else

There is a branch for 'select', right?

should answer the question!

Quote:updated as follows:
Code:
switch ($reqtype) {
    case "delete":
        deleteIfMatch()
    case "select"
        selectIfMatch()
    deault:
        query()
}

As far as I can tell, we haven't implemented those functions, yet. We should implement them, soon. When implementing them, make sure to run the tests using 'make test' frequently and make sure all tests are happy.

zhihao

(09-26-2020 06:27 PM)lingu Wrote: [ -> ]
(09-26-2020 04:34 PM)zhihao Wrote: [ -> ]
(09-26-2020 12:38 PM)lingu Wrote: [ -> ]
(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]if $reqtype is "delete"
deleteIfMatch()
else
query()
}

Pls make it a switch although the implementation may use if/else

There is a branch for 'select', right?

should answer the question!
Yes, I miss the branch 'select' and added it into headpost

(09-26-2020 06:27 PM)lingu Wrote: [ -> ]
Quote:updated as follows:
Code:
switch ($reqtype) {
    case "delete":
        deleteIfMatch()
    case "select"
        selectIfMatch()
    deault:
        query()
}

As far as I can tell, we haven't implemented those functions, yet. We should implement them, soon. When implementing them, make sure to run the tests using 'make test' frequently and make sure all tests are happy.

OK
(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]procone.py is used for generating analysis result for one case.

Code:
在某一案例内容中搜索key{1,2,3},构建"keys": []。
Code:
main() {
    set $tycajson_pfn as a insert.json
    get $reqtype from $tycajson_pfn
    switch ($reqtype) {
        case "delete":
            deleteIfMatch()
        case "select"
            selectIfMatch()

how does 'selectIfMatch' work? Pls specify.

zhihao

(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
((->tycajson_pfn: file of json cases
rid --insitu ((insert.json->$tycajson_pfn ))
))
RR lingu

(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]
Code:
create file insert.json with request template which has empty value
create file ((insert.json->$tycajson_pfn )) with request template which has empty value
RR lingu

(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]
Code:
generate result file
    else
        create empty result file
}
delete logic
RR lingu
(08-10-2021 01:58 PM)zhihao Wrote: [ -> ]
(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
((->tycajson_pfn: file of json cases
rid --insitu ((insert.json->$tycajson_pfn ))
))
RR lingu

(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]
Code:
create file insert.json with request template which has empty value
create file ((insert.json->$tycajson_pfn )) with request template which has empty value
RR lingu

OK.

Quote:
(09-25-2020 01:15 AM)zhihao Wrote: [ -> ]
Code:
generate result file
    else
        create empty result file
}
delete logic
RR lingu

without a result file, how does the client know the status of the delete op?

zhihao

add delete_one_case() to headpost according to http://rar.shufangkeji.com:60380/showthr...6#pid48416
Code:
fw: file handler of one result file
newftexts: request content
insblock: content of insert block of the case in the corpus
blank_json: the value of -- {"keys":[],"caseid":"___"}
delete_one_case(fw, newftexts, insblock){
  caseid = get caseid from insblock
  newcaseid = get caseid from newftexts
  if ($caseid  == $newcaseid){
    write $blank_json to $fw
  }
}
Pages: 1 2
Reference URL's