Internet Explorer dom behaves differently in different environment - java

I have a powershell script which is like this
param(
[string]$u,
[string]$p
)
$username = $u
$password = $p
cd HKCU:\"Software\Microsoft\Windows\CurrentVersion\Internet Settings"
set-itemproperty . ProxyEnable 1
$url = "https://ameriprisestage.service-now.com/"
$ie = New-Object -com internetexplorer.application;
$ie.visible = $true;
$ie.navigate($url);
while ($ie.ReadyState -ne 4 -or $ie.Busy)
{
start-sleep -s 5;
}
$ieFrame = $ie.Document.getElementById("gsft_main")
if (($ieFrame -eq $null)) {
"ieframe is null" | Out-File 'D:\\file.txt' -Append
exit
}
$usrCtrl = $ie.Document.getElementById("user_name")
if ($usrCtrl -eq $null) {
" usrCtrl is null at 1" |Out-File 'D:\\file.txt' -Append
}
$usrCtrl = $ieFrame.document.getElementById("user_name")
if ($usrCtrl -eq $null) {
" usrCtrl is null at 2" |Out-File 'D:\\file.txt' -Append
}
$usrCtrl = $ieFrame.contentWindow.document.getElementById("user_name")
if ($usrCtrl -eq $null) {
" usrCtrl is null at 3" |Out-File 'D:\\file.txt' -Append
}
$usrCtrl = $ieFrame.contentDocument.getElementById("user_name")
if ($usrCtrl -eq $null) {
" usrCtrl is null at 4" |Out-File 'D:\\file.txt' -Append
}
$usrCtrl = $ieFrame.getElementById("user_name")
if ($usrCtrl -eq $null) {
" usrCtrl is null at 5" |Out-File 'D:\\file.txt' -Append
}
$usrCtrl.value=$username
$pass=$ieFrame.contentWindow.Document.getElementById("user_password").value=$password
$buttn=$ieFrame.contentWindow.document.getElementById("sysverb_login").click()
when i run this code from powershell ISE I get usrCtrl not null at 3 and 5. but when i invoke the same code from java program i get usrCtrl is null at 1, 2,3 4 and 5.
I can't figure out what is happening. can someone help me ..
Thanks
Sujith

Change this
cd HKCU:\"Software\Microsoft\Windows\CurrentVersion\Internet Settings"
to
cd "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
AND this:
D:\\file.txt
to
D:\file.txt

Related

No output of Perl script called from Java

I am using Ganymed ssh lib in Java to connect to Linux machine and execute some unix scripts, and display their output.
I am running a parent shell script which in turn runs few other sub-scripts and finally a perl script. All work well for the shell scripts, but when it reaches the perl script, I stop getting any output.
If I run the parent script manually on Linux server I see output from perl without issues.
Here's the relevant java code, connecting to the machine and calling the shell script, and returning a BufferedReader from where the output could be read line by line :
try {
conn = new Connection(server);
conn.connect();
boolean isAuthenticated = conn.authenticateWithPublicKey(user, keyfile, keyfilePass);
if (isAuthenticated == false) {
throw new IOException("Authentication failed.");
}
sess = conn.openSession();
if (param == null) {
sess.execCommand(". ./.bash_profile; cd $APP_HOME; ./parent_script.sh");
}
else {...}
InputStream stdout = new StreamGobbler(sess.getStdout());
reader = new BufferedReader(new InputStreamReader(stdout));
} catch (IOException e) {
e.printStackTrace();
}
My parent shell script called looks like this :
./start1 #script1 output OK
./start2 #script2 output OK
./start3 #script3 output OK
/u01/app/perl_script.pl # NO OUTPUT HERE :(
Would anyone have any idea why this happens ?
EDIT : Adding perl script
#!/u01/app/repo/code/sh/perl.sh
use FindBin qw/ $Bin /;
use File::Basename qw/ dirname /;
use lib (dirname($Bin). "/pm" );
use Capture::Tiny qw/:all/;
use Data::Dumper;
use Archive::Zip;
use XML::Simple;
use MXA;
my $mx = new MXA;
chdir $mx->config->{$APP_HOME};
warn Dumper { targets => $mx->config->{RTBS} };
foreach my $target (keys %{ $mx->config->{RTBS}->{Targets} }) {
my $cfg = $mx->config->{RTBS}->{Targets}->{$target};
my #commands = (
[
...
],
[
'unzip',
'-o',
"$cfg->{ConfigName}.zip",
'Internal/AdapterConfig/Driver.xml'
],
[
'zip',
"$cfg->{ConfigName}.zip",
'Internal/AdapterConfig/Driver.xml'
],
[
'rm -rf Internal'
],
[
"rm -f $cfg->{ConfigName}.zip"
],
);
foreach my $cmnd (#commands) {
warn Dumper { command => $cmnd };
my ($stdout, $stderr, $status) = capture {
system(#{ $cmnd });
};
warn Dumper { stdout => $stdout,
stderr => $stderr,
status => $status };
}
=pod
warn "runnnig -scriptant /ANT_FILE:mxrt.RT_${target}argets_std.xml /ANT_TARGET:exportConfig -jopt:-DconfigName=Fixing -jopt:-DfileName=Fixing.zip');
($stdout, $stderr, $status) = capture {
system('./command.app', '-scriptant -parameters');
}
($stdout, $stderr, $status) = capture {
system('unzip Real-time.zip Internal/AdapterConfig/Driver.xml');
};
my $xml = XMLin('Internal/AdapterConfig/MDPDriver.xml');
print Dumper { xml => $xml };
[[ ${AREAS} == "pr" ]] && {
${PREFIX}/substitute_mdp_driver_parts Internal/AdapterConfig/Driver.xml 123 controller#mdp-a-n1,controller#mdp-a-n2
} || {
${PREFIX}/substitute_mdp_driver_parts Internal/AdapterConfig/Driver.xml z8pnOYpulGnWrR47y5UH0e96IU0OLadFdW/Bm controller#md-uat-n1,controller#md-uat-n2
}
zip Real-time.zip Internal/AdapterConfig/Driver.xml
rm -rf Internal
rm -f Real-time.zip
print $mx->Dump( stdout => $stdout,
stderr => $stderr,
status => $status );
=cut
}
The part of your Perl code that produces the output is:
warn Dumper { stdout => $stdout,
stderr => $stderr,
status => $status };
Looking at the documentation for warn() we see:
Emits a warning, usually by printing it to STDERR
But your Java program is reading from STDOUT.
InputStream stdout = new StreamGobbler(sess.getStdout());
You have a couple of options.
Change your Perl code to send the output to STDOUT instead of STDERR. This could be a simple as changing warn() to print().
When calling the Perl program in the shell script, redirect STDERR to STDOUT.
/u01/app/perl_script.pl 2>&1
I guess you could also set up your Java program to read from STDERR as well. But I'm not a Java programmer, so I wouldn't be able to advise you on the best way to do that.

Error when trying to parse an edifact-file with antlr2 when an attribute value contains a keyword

I have the ungrateful task to fix a bug in an old antlr2 parser which is used to parse an edifact file. Unfortunatly I'm not very familar with antlr2 or parser at all and I can not get it to work.
The edifact-files look like this:
ABC+Name+Surname+zip+city+street+country+1961219++0037141008'
XYZ+Company+++XYZ+zip+street'
LMN+20081010+1100'
There are several different segments, which start with a keyword. E.g. XYZ or ABC. The keywords are followed by different attribute values, all separated with a '+'. An attribute value may be empty. Each segment ends with an '.
The problem is, whenever a data attribute contains a keyword, the parser throws an error:
unexpected token: XYZ
XYZ+Company+++XYZ+zip+street'
This is an excerpt from the grammar file:
// $ANTLR 2.7.6
xyz: "XYZ" ELT_SEP!
(xyz1_1a:ANUM|xyz1_1b:NUM) {lq(90,xyz1_1a,xyz1_1b,"XYZ1-1"+LQ90)}? ELT_SEP!
(xyz1_2a:ANUM|xyz1_2b:NUM)? {lq_(90,xyz1_2a,xyz1_2b,"XYZ1-2"+LQ90)}? ELT_SEP!
(xyz1_3a:ANUM|xyz1_3b:NUM)? {lq_(90,xyz1_3a,xyz1_3b,"XYZ1-3"+LQ90)}? ELT_SEP!
(xyz2a:ANUM|xyz2b:NUM)? {lq_(3,xyz2a,xyz2b,"XYZ2"+LQ3)}? ELT_SEP!
(xyz3a:ANUM|xyz3b:NUM)? {lq_(6,xyz3a,xyz3b,"XYZ3"+LQ6)}? ELT_SEP!
(xyz4a:ANUM|xyz4b:NUM) {lq(30,xyz4a,xyz4b,"XYZ4"+LQ30)}?
(ELT_SEP! (xyz5a:ANUM|xyz5b:NUM)?)? {lq_(46,xyz5a,xyz5b,"XYZ5"+LQ46)}? SEG_TERM!
{
if (skipNachricht()) return;
Xyz xyz = new Xyz();
xyz.xyz1_1 = getText(nn(xyz1_1a, xyz1_1b));
xyz.xyz1_2 = getText(nn(xyz1_2a, xyz1_2b));
xyz.xyz1_3 = getText(nn(xyz1_3a, xyz1_3b));
xyz.xyz2 = getText(nn(xyz2a, xyz2b));
xyz.xyz3 = getText(nn(xyz3a, xyz3b));
xyz.xyz4 = getText(nn(xyz4a, xyz4b));
xyz.xyz5 = getText(nn(xyz5a, xyz5b));
handleXyz(xyz);
}
;
/*
* Lexer
*/
class EdifactLexer extends Lexer;
options {
k=2;
filter=true;
charVocabulary = '\3'..'\377'; // Latin
}
DEZ_SEP: ','
{
//System.out.println("Found dez_sep: " + getText());
}
;
ELT_SEP: '+'
{
//System.out.println("Found elt_sep: " + getText());
}
;
SEG_TERM: '\''
{
// System.out.println("Found seg_term: " + getText());
}
;
NUM: (('0'..'9')+ (',' ('0'..'9')+)? ('+' | '\''))
=> ('0'..'9')+ (',' ('0'..'9')+)?
{
//System.out.println("num_: " + getText());
}
|
((ESCAPED | ~('?' | '+' | '\'' | ',' | '\r' | '\n'))+ )
=> ( ESCAPED | ~('?' | '+' | '\'' | ',' | '\r' | '\n'))+
{
$setType(ANUM);
//System.out.println("anum: " + getText());
}
|
(WRONGLY_ESCAPED) => WRONGLY_ESCAPED
{$setType(WRONGLY_ESCAPED); }
;
protected
WRONGLY_ESCAPED: '?' ~('?' | ':' | '+' | '\'' | ',')
{
//System.out.println("Found wrong_escaped: " + getText());
}
;
protected
ESCAPED: '?'
( ',' {$setText(","); }
| '?' {$setText("?"); }
| '\'' {$setText("'"); }
| ':' {$setText(":"); }
| '+' {$setText("+"); }
)
{
//System.out.println("Found escaped: " + getText());
}
;
NEWLINE : ( "\r\n" // DOS
| '\r' // MAC
| '\n' // Unix
)
{ newline();
$setType(Token.SKIP);
}
;
Any help is really appreciated :).
It might not be the best solution but I finally found a way to solve my problem.
So, if anybody is stumbling about a similar issue, this is my solution:
I wrote a method, that changes the token-type to ANUM if the current token-type matches any of my keywords:
void ckt() throws TokenStreamException, SemanticException {
if (mKeywordList.contains(LT(1).getType())) {
LT(1).setType(ANUM);
}
}
The method is called in my parser rule before trying to access an ANUM-Token:
xyz: "XYZ" ELT_SEP!
{ckt();}(xyz1_1a:ANUM|xyz1_1b:NUM) {lq(90,xyz1_1a,xyz1_1b,"XYZ1-1"+LQ90)}? ELT_SEP!
{ckt();}(xyz1_2a:ANUM|xyz1_2b:NUM)? {lq_(90,xyz1_2a,xyz1_2b,"XYZ1-2"+LQ90)}? ELT_SEP!
{ckt();}(xyz1_3a:ANUM|xyz1_3b:NUM)? {lq_(90,xyz1_3a,xyz1_3b,"XYZ1-3"+LQ90)}? ELT_SEP!
{ckt();}(xyz2a:ANUM|xyz2b:NUM)? {lq_(3,xyz2a,xyz2b,"XYZ2"+LQ3)}? ELT_SEP!
{ckt();}(xyz3a:ANUM|xyz3b:NUM)? {lq_(6,xyz3a,xyz3b,"XYZ3"+LQ6)}? ELT_SEP!
{ckt();}(xyz4a:ANUM|xyz4b:NUM) {lq(30,xyz4a,xyz4b,"XYZ4"+LQ30)}?
(ELT_SEP! {ckt();}(xyz5a:ANUM|xyz5b:NUM)?)? {lq_(46,xyz5a,xyz5b,"XYZ5"+LQ46)}? SEG_TERM!
{
if (skipNachricht()) return;
Xyz xyz = new Xyz();
xyz.xyz1_1 = getText(nn(xyz1_1a, xyz1_1b));
xyz.xyz1_2 = getText(nn(xyz1_2a, xyz1_2b));
xyz.xyz1_3 = getText(nn(xyz1_3a, xyz1_3b));
xyz.xyz2 = getText(nn(xyz2a, xyz2b));
xyz.xyz3 = getText(nn(xyz3a, xyz3b));
xyz.xyz4 = getText(nn(xyz4a, xyz4b));
xyz.xyz5 = getText(nn(xyz5a, xyz5b));
handleXyz(xyz);
}
;

Script that's run from processing is not executing properly

I have a shell script that creates a text file that contains the current settings from my camera:
#!/bin/sh
file="test.txt"
[[ -f "$file" ]] && rm -f "$file"
var=$(gphoto2 --summary)
echo "$var" >> "test.txt"
if [ $? -eq 0 ]
then
echo "Successfully created file"
exit 0
else
echo "Could not create file" >&2
exit 1
fi
The script works as I think it should when I run it from terminal, but when I run the following processing app the text file is created but does not contain any of the information from the camera:
import java.util.*;
import java.io.*;
void setup() {
size(480, 120);
camSummary();
}
void draw() {
}
void camSummary() {
String commandToRun = "./ex2.sh";
File workingDir = new File("/Users/loren/Documents/RC/CamSoft/");
String returnedValues; // value to return any results
try {
println("in try");
Process p = Runtime.getRuntime().exec(commandToRun, null, workingDir);
int i = p.waitFor();
if (i==0) {
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ( (returnedValues = stdInput.readLine ()) != null) {
println(returnedValues);
}
} else{
println("i is: " + i);
}
}
catch(Throwable t) {
println(t);
}
}
Eventually I would like to read some of the data directly from the script into variables and then use those variables in processing.
Could someone help me sort this out?
Thank you,
Loren
Alternate script:
#!/bin/sh
set -x
exec 2>&1
file="test.txt"
[ -f "$file" ] && rm -f "$file"
# you want to store the output of gphoto2 in a variable
# var=$(gphoto2 --summary)
# problem 1: what if PATH environment variable is wrong (i.e. gphoto2 not accessible)?
# problem 2: what if gphoto2 outputs to stderr?
# it's better first to:
echo first if
if ! type gphoto2 > /dev/null 2>&1; then
echo "gphoto2 not found!" >&2
exit 1
fi
echo second if
# Why using var?...
gphoto2 --summary > "$file" 2>&1
# if you insert any echo here, you will alter $?
if [ $? -eq 0 ]; then
echo "Successfully created file"
exit 0
else
echo "Could not create file" >&2
exit 1
fi
There are several issues in your shell script. Let's correct and improve it together.
#!/bin/sh
file="test.txt"
[ -f "$file" ] && rm -f "$file"
# you want to store the output of gphoto2 in a variable
# var=$(gphoto2 --summary)
# problem 1: what if PATH environment variable is wrong (i.e. gphoto2 not accessible)?
# problem 2: what if gphoto2 outputs to stderr?
# it's better first to:
if ! type gphoto2 > /dev/null 2>&1; then
echo "gphoto2 not found!" >&2
exit 1
fi
# Why using var?...
gphoto2 --summary > "$file" 2>&1
# if you insert any echo here, you will alter $?
if [ $? -eq 0 ]; then
echo "Successfully created file"
exit 0
else
echo "Could not create file" >&2
exit 1
fi

Elasticsearch does not see static scripts?

Get a strange behavior of my Elasticsearch cluster: seems that it does not see static groovy scripts any more.
It complains that "dynamic scripting is disabled", however I am using stating script and correct name of it.
They did work before, and now can't understand what was changed.
Here are steps I am using to reproduce the problem:
Create index with mapping defining one string field and on nested object:
curl -XPUT localhost:9200/test/ -d '{
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}'
curl -XPUT localhost:9200/test/_mapping/testtype -d '{
"testtype": {
"properties": {
"name": {
"type": "string"
},
"features": {
"type": "nested",
"properties": {
"key": {
"type": "string",
"value": {
"type": "string"
}
}
}
}
}
}
}'
response:
{
"acknowledged": true
}
Put a single object there:
curl -XPUT localhost:9200/test/testtype/1 -d '{
"name": "hello",
"features": []
}'
Call update using the script:
curl -XPOST http://localhost:9200/test/testtype/1/_update -d '{
"script": "add-feature-if-not-exists",
"params": {
"new_feature": {
"key": "Manufacturer",
"value": "China"
}
}
}'
response:
{
"error": "RemoteTransportException[[esnew1][inet[/78.46.100.39:9300]][indices:data/write/update]];
nested: ElasticsearchIllegalArgumentException[failed to execute script];
nested: ScriptException[dynamic scripting for [groovy] disabled]; ",
"status": 400
}
Getting "dynamic scripting for [groovy] disabled" - but I am using a reference to static script name in "script" field. However I've seen this message occurring if the name of script was incorrect. But looks like it is correct:
The script is located in /etc/elasticsearch/scripts/ .
Verifying that /etc/elasticsearch is used as a config directory:
ps aux | grep elas
elastic+ 944 0.8 4.0 21523740 1322820 ? Sl 15:35 0:39 /usr/lib/jvm/java-7-oracle/bin/java -Xms16g -Xmx16g -Xss256k -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Delasticsearch -Des.pidfile=/var/run/elasticsearch.pid -Des.path.home=/usr/share/elasticsearch -cp :/usr/share/elasticsearch/lib/elasticsearch-1.4.0.jar:/usr/share/elasticsearch/lib/*:/usr/share/elasticsearch/lib/sigar/* -Des.default.config=/etc/elasticsearch/elasticsearch.yml -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=/var/log/elasticsearch -Des.default.path.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -Des.default.path.conf=/etc/elasticsearch org.elasticsearch.bootstrap.Elasticsearch
Looking if script is there:
$ ls -l /etc/elasticsearch/ total 24 -rw-r--r-- 1 root root
total 24
-rw-r--r-- 1 root root 13683 Nov 25 14:52 elasticsearch.yml
-rw-r--r-- 1 root root 1511 Nov 15 04:13 logging.yml
drwxr-xr-x 2 root root 4096 Nov 25 15:07 scripts
$ ls -l /etc/elasticsearch/scripts/ total 8 -rw-r--r-- 1
total 8
-rw-r--r-- 1 elasticsearch elasticsearch 438 Nov 25 15:07 add-feature-if-not-exists.groovy
-rw-r--r-- 1 elasticsearch elasticsearch 506 Nov 23 02:52 add-review-if-not-exists.groovy
Any hints on why this is happening? What else have I check?
Update: cluster has two nodes.
Config on node1:
cluster.name: myclustername
node.name: "esnew1"
node.master: true
node.data: true
bootstrap.mlockall: true
network.host: zz.zz.zz.zz
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["esnew1.company.com","esnew2.company.com"]
index.store.type: niofs
script.disable_dynamic: true
script.auto_reload_enabled: true
watcher.interval: 30s
Config on node 2:
cluster.name: myclustername
node.name: "esnew2"
node.master: true
node.data: true
bootstrap.mlockall: true
metwork.bind_host: 127.0.0.1,zz.zz.zz.zz
network.publish_host: zz.zz.zz.zz
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["esnew1.company.com","esnew2.company.com"]
index.store.type: niofs
script.disable_dynamic: true
script.auto_reload_enabled: true
watcher.interval: 30s
Elasticsearch version:
$ curl localhost:9200
{
"status" : 200,
"name" : "esnew2",
"cluster_name" : "myclustername",
"version" : {
"number" : "1.4.0",
"build_hash" : "bc94bd81298f81c656893ab1ddddd30a99356066",
"build_timestamp" : "2014-11-05T14:26:12Z",
"build_snapshot" : false,
"lucene_version" : "4.10.2"
},
"tagline" : "You Know, for Search"
}
P.S.: One observation confirming that probably ES just don't see the scripts: at some moment, ES was seeing one script, but did not see another. After restart it does not see none of them.
P.P.S.: The script:
do_add = false
def stringsEqual(s1, s2) {
if (s1 == null) {
return s2 == null;
}
return s1.equalsIgnoreCase(s2);
}
for (item in ctx._source.features) {
if (stringsEqual(item['key'], new_feature.key) {
if (! stringsEqual(item['value'], new_feature.value) {
item.value = new_feature.value;
}
} else {
do_add = true
}
}
if (do_add) {
ctx._source.features.add(new_feature)
}

Cypher do not repeat same results

I have a cypher code that goes like this :
start n=node(*)
match p=n-[r:OWES*1..200]->n
return extract(s in relationships(p) : s.amount),
extract(t in nodes(p) : t.name),
length(p)
The query gives back nodes in a closed circle connected with relation OWES up to 200 level deep .
The results given are :
2
[155.55, 100641359]
[LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ ]
2
[100641359, 155.55]
[SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , SASA ]
3
[100641359, 100641367, 550111.55]
[SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , ADVOKAT KOSTIC JEVREM VRBAS , SASA ]
3
[100641367, 550111.55, 100641359]
[LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , ADVOKAT KOSTIC JEVREM VRBAS , SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ ]
3
[550111.55, 100641359, 100641367]
[ADVOKAT KOSTIC JEVREM VRBAS , SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , ADVOKAT KOSTIC JEVREM VRBAS ]
So I get my results returning more times , if it is 3 relations level I get 3 results , 2 I get 2 same results in diferent order .How to change my cypher to get result only once for one path by not giving up from * in a cypher . If not in cypher can I handle this some way in Java .
This is using Cypher 2.0 because I'm making use of the STARTNODE function.
It is a bit of a monstrosity, but it works. I wouldn't use it without adding some serious constraints to keep the overall collection size down.
CREATE
(a {name:'A'}),
(b {name:'B'}),
(c {name:'C'}),
(d {name:'D'}),
(e {name:'E'}),
(f {name:'F'}),
a-[:OWES {amount:100}]->b,
b-[:OWES {amount:200}]->c,
c-[:OWES {amount:300}]->a,
e-[:OWES {amount:400}]->f,
f-[:OWES {amount:500}]->e
start nn=node(*)
MATCH nn-[nr:OWES]->()
WITH nn, nr ORDER BY nn.name, nr.amount
WITH COLLECT([nn, nr.amount]) as sortedPairs
START n=node(*)
match p=n-[r:OWES*1..200]->n
WITH sortedPairs,
extract(s in r: [STARTNODE(s), s.amount]) as pairs
WITH
filter(sp in sortedPairs: ANY(f in pairs WHERE HEAD(f) = HEAD(sp) AND LAST(f) = LAST(sp))) as finalPairs
return distinct
extract(s in finalPairs : HEAD(s)),
extract(s in finalPairs : LAST(s)),
length(finalPairs)
Results:
Detailed Query Results
Query Results
+----------------------------------------------------------------------------------------------------------------------+
| extract(s in finalPairs : HEAD(s)) | extract(s in finalPairs : LAST(s)) | length(finalPairs) |
+----------------------------------------------------------------------------------------------------------------------+
| [Node[39]{name:"E"},Node[38]{name:"F"}] | [400,500] | 2 |
| [Node[43]{name:"A"},Node[42]{name:"B"},Node[41]{name:"C"}] | [100,200,300] | 3 |
+----------------------------------------------------------------------------------------------------------------------+
2 rows
13 ms
Execution Plan
Distinct(_rows=2, _db_hits=0)
ColumnFilter(symKeys=["sortedPairs", "pairs", "finalPairs"], returnItemNames=["finalPairs"], _rows=5, _db_hits=0)
Extract(symKeys=["sortedPairs", "pairs"], exprKeys=["finalPairs"], _rows=5, _db_hits=0)
ColumnFilter(symKeys=["n", "sortedPairs", " UNNAMED155", "pairs", "p", "r"], returnItemNames=["sortedPairs", "pairs"], _rows=5, _db_hits=0)
Extract(symKeys=["n", "sortedPairs", " UNNAMED155", "p", "r"], exprKeys=["pairs"], _rows=5, _db_hits=13)
ExtractPath(name="p", patterns=[" UNNAMED155=n-[:OWES*1..200]->n"], _rows=5, _db_hits=0)
PatternMatch(g="(n)-[' UNNAMED155']-(n)", _rows=5, _db_hits=0)
AllNodes(identifier="n", _rows=6, _db_hits=6)
ColumnFilter(symKeys=[" INTERNAL_AGGREGATEfbdcf75a-046d-4501-9696-1e2c80469b29"], returnItemNames=["sortedPairs"], _rows=1, _db_hits=0)
EagerAggregation(keys=[], aggregates=["( INTERNAL_AGGREGATEfbdcf75a-046d-4501-9696-1e2c80469b29,Collect)"], _rows=1, _db_hits=5)
ColumnFilter(symKeys=["nr", " UNNAMEDS-2101388511", " UNNAMEDS2003458696", "nn", " UNNAMED39"], returnItemNames=["nn", "nr"], _rows=5, _db_hits=0)
Sort(descr=["SortItem(Cached( UNNAMEDS2003458696 of type Any),true)", "SortItem(Cached( UNNAMEDS-2101388511 of type Any),true)"], _rows=5, _db_hits=0)
Extract(symKeys=["nn", " UNNAMED39", "nr"], exprKeys=[" UNNAMEDS2003458696", " UNNAMEDS-2101388511"], _rows=5, _db_hits=10)
PatternMatch(g="(nn)-['nr']-( UNNAMED39)", _rows=5, _db_hits=0)
AllNodes(identifier="nn", _rows=6, _db_hits=6)

Categories