-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[absolete]Connectors' markers implementation -- 010, 060, 069 #157
Changes from 1 commit
e5d36f3
ffe85f7
0d943b7
a033b60
d73cc39
087d379
be8c7f6
af8e53b
317d1c9
aa7f30a
99d39c1
8cfbb65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ PORT='8890' | |
GRAPH= | ||
GRAPH_PATH='DAV/ATLAS' | ||
MODE="f" | ||
DELIMITER="NOT SPECIFIED" | ||
BATCHMODE="d" | ||
EOBatch='\x17' | ||
|
||
# File .credentials may contain variable definition for USER and PASSWD | ||
if [ -f ".credentials" ]; then | ||
|
@@ -132,8 +133,7 @@ upload_files () { | |
upload_stream () { | ||
EOProcess="\0" | ||
|
||
local delimiter=$'\n' | ||
|
||
local delimiter='' | ||
[ -z "$TYPE" ] && { echo "(ERROR) input data format is not specified. Exiting." >&2; return 2;} | ||
while [[ $# > 0 ]] | ||
do | ||
|
@@ -153,6 +153,8 @@ upload_stream () { | |
shift | ||
done | ||
|
||
[ -z "$delimiter" ] && { echo "(ERROR) Delimiter is not specified. Exiting." >&2; return 2;} | ||
|
||
case $TYPE in | ||
t|ttl) | ||
cmd="$cmdTTL --data-urlencode res-file@-" | ||
|
@@ -209,8 +211,12 @@ do | |
MODE="${2,,}" | ||
shift | ||
;; | ||
-d|--delimiter) | ||
DELIMITER=`echo -e $2` | ||
-b|--batch | ||
BATCHMODE="${2,,}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why |
||
shift | ||
;; | ||
-B|--eob) | ||
EOBatch=`echo -ne $2` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we have quite a long discussion about this mistake I`ve done when wrote this script :)
Resume:
|
||
shift | ||
;; | ||
-E|--eop) | ||
|
@@ -244,10 +250,24 @@ done | |
[ -z "$HOST" ] && echo "(ERROR) empty host value." >&2 && exit 2 | ||
[ -z "$PORT" ] && echo "(ERROR) empty port value." >&2 && exit 2 | ||
[ -z "$GRAPH" ] && GRAPH=http://$HOST:$PORT/$GRAPH_PATH | ||
[ -z "$DELIMITER" ] && DELIMITER=$'\0' | ||
[ "x$DELIMITER" = "xNOT SPECIFIED" ] && DELIMITER=$'\n' | ||
|
||
[ -n "$EOB" ] && EOBatch="$EOB" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found an implicit mistake in my code because of that question. Thank you! The thing is that I named all variables which keeps parameters from a comand line like EOM/EOP/EOB (my mistake is that I named it as "EOBatch"). In 010 connector I saw that it would be better to pass markers from another variables EOMessage/EOProcess, because it was a little bit inconvenient for me (according to the code's logic) to use variables EOM/EOP. I hope, after renaming it'll become much more clear. I'll create an extra commit with explanation of my decision. |
||
[ -n "$EOP" ] && EOProcess="$EOP" | ||
|
||
case $BATCHMODE in | ||
e|enabled) | ||
[ -z "$EOB" ] && EOBatch="\n" | ||
;; | ||
d|disabled) | ||
( [ -z "$EOB" ] || [ $EOB == "\x17" ] || [ $EOBatch == "\x17" ] ) && EOBatch="\n" | ||
( [ -n "$EOB" ] && [ ! $EOB == "\x17" ] ) && EOBatch="$EOB" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I`m getting this First, what does it say now (suggesting, that Concerning conditions... as we have this lines above:
within the
So, in plain words -- what should be done during this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I supposed that if batch mode is disabled (by hands or by default):
if batch mode is enabled:
UPD: it seems I forgot about quotes at all in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright. I think there`s a little bit of mess happened with enabled/disabled batch mode etc... First, about this (just to make sure we do understand things same way).
This checks:
are string comparison. Works this way:
Now Next, about the general logic. Here`s the results:
How do I read it: batch mode is actually enabled in three cases:
While I would expect the following table:
Two cases added:
In other words:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *) And about forgotten quotes: it was totally OK; shell takes non-quoted stuff as a string unless it is a keyword or the string is followed by
So in
Yet in this case quotes are also OK to use, as no wildcard or something is used. |
||
;; | ||
*) | ||
echo "(ERROR) Unexpected batch-mode parameter." >&2 && { [ -n "$BATCHMODE" ] && usage && return 2; } | ||
break | ||
;; | ||
esac | ||
|
||
cmdTTL="curl --retry 3 -s -f -X POST --digest -u $USER:$PASSWD -H Content-Type:text/turtle -G http://$HOST:$PORT/sparql-graph-crud-auth --data-urlencode graph=$GRAPH" | ||
cmdSPARQL="curl --retry 3 -s -f -H 'Accept: text/csv' -G http://$HOST:$PORT/sparql --data-urlencode query" | ||
|
||
|
@@ -256,7 +276,7 @@ case $MODE in | |
upload_files $*; | ||
;; | ||
s) | ||
upload_stream -d "$DELIMITER"; | ||
upload_stream -d "$EOBatch"; | ||
;; | ||
*) | ||
echo "(ERROR) $MODE: unsupported mode." >&2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bracket is missed:
-b|--batch)