Eric C.Y. Lee
Eric C.Y. Lee

Reputation: 1

Perl CPAN Neo4p retrieve RETURN count object

I am using PERL's CPAN Neo4p module, already define a cypher query of Neo4j. But the return type is "count" function. Count for the numbers of return apgd results. The code is:

my $query = REST::Neo4p::Query->new(
   "match (apgd)-[:CURRENT_UNDER]->(status {status:'$cri'}),".
    "(apgd)-[:HAS_NAME]->(name), ".
    "(apgd)-[:HAS_SEQUENCE]->(sequence), ".
    "(apgd)-[:HOST_IN]->(host), ".
    "(apgd)-[:HAS_LAMP_ID]->(lampid), ".
    "(apgd)-[:FROM]->(source) ".
"return (apgd),(name),(sequence),(source),(lampid),(host),count(apgd)"
);
$query->execute;

It will return 7 objects. So there is another function to get the result,

    while (my $result = $query->fetch)
    {
    print $result->[0]->get_property('id')."\t”;
    print $result->[1]->get_property('name')."\t”;
    print $result->[2]->get_property('seq')."\t”;
    print $result->[6]->get_property('')."\n";
    }

About the line: print $result->[6]->get_property('')."\n";

What is the property name? Thanks

Upvotes: 0

Views: 152

Answers (1)

MAJ
MAJ

Reputation: 401

$result is an arrayref that contains the items asked for in the RETURN clause. So, the first 6 items of the array are REST::Neo4p::Node objects, but the seventh is just a scalar, the value of count(agpd). That is, $result->[6] is itself the value of count(agpd), for each row.

Upvotes: 1

Related Questions