How to output sets in Gremlin through Orientdb REST API? - orientdb

In my project, I'm sending Gremlin scripts via the REST API of Orientdb.
I'm having problem returning the values inside sets collected during the graph traversal.
I have a simple Graph setup.
User-- FollowsMovies -- > Movies
User-- FollowsActors -- > Actors
u= g.v('12:1');
following= [] as Set;
u.as('x').out('FollowsMovies').aggregate(following).back('x').out('FollowsActors').aggregate(following);
return following.toString();
however, the script returns nothing. If I ask for size of 'following', it returns 0, although it is not supposed to be empty.
I Tried the same code on the gremlin console and it worked as expected. Can anyone suggest how to correctly output elements of a set?
Thanks for you help in advance.

Try to add iterate()at the end of your query.
See: http://gremlindocs.com/#methods/pipe-iterate

Related

Memcached lru_crawler metadump doesn't returns END as response

We are currently working on getting all the keys in Memcached through:
lru_crawler metadump all
For this implementation, we are expecting END or OK at the end of result.
But Memcached doesn't return any response code after the end of data. It just simply returns the metadata.
lru_crawler metadump 1
key=key exp=-1 la=1588598718 cas=1 fetch=no cls=1 size=80
We are using Memcached version 1.4.33.
Is there any configuration that we need to set up for this to return a response code at the end (or) Is there any way that we can find the end of metadump result other than END or OK?
Thanks in advance.
Seems it is a known issue with the Memcahed
https://github.com/memcached/memcached/issues/667
(came across this post when researching a project I'm working on)
It is no longer an issue in current memcache implementations - I'm using 1.5.6 and get 'END'. However it is my experience that this does not always return the full list. I suspect that may be due the order of items in the LRU list changing while command is running (I get 99-100% of the keys when the server is getting hammered).

CQ5 QueryBuilder Search Not Working as Expected (when property NOT present)

I'm trying to produce a query that will return all pages under a path where a property is NOT present.
Effectively I want the query builder query that will produce the following xpath: /jcr:root/content/site/my/path//element(*, cq:Page)[not(jcr:content/task/#finished)]
For CQ 5.3 the 'exists' property doesn't seem to be present (according to the docs: http://docs.adobe.com/docs/en/cq/5-3/javadoc/com/day/cq/search/eval/JcrPropertyPredicateEvaluator.html), however it looks like I can use 'not', so I've tried the following two examples but neither work as I expect in query debugger:
1
path=/content/site/my/path
type=cq:Page
property=jcr:content/task/finished
property.operation=not
2
path=/content/site/my/path
type=cq:Page
property=jcr:content/task/finished
property.operation=not
property.value=true
I've also seen pages that suggest these should work, and I can't seem to see any hotfixes that would cover fixing this (assuming it isn't actually working correctly).
Can anyone offer a solution or point out where I'm going wrong?
Using CQ 5.3, upgraded to crx 2.2.
Cheers
Chris
I have a few resource that I hope help you:
My blog post about query API options: http://itgumby.github.io/blog/2014/10/cq-queries-demystified/
6 Dimension's post about specific query examples: http://labs.sixdimensions.com/blog/2014-10-07/9-jcr-sql-2-queries-every-aem-dev-should-know/
Adobe QueryBuilder documentation: http://docs.adobe.com/docs/en/aem/6-0/develop/search/querybuilder-api.html
Non-empty SQL2 (From the 6D post):
SELECT * FROM [cq:PageContent] WHERE [jcr:title] IS NOT NULL
Which means you could convert that to WHERE [jcr:title] IS NULL
If using QueryBuilder predicates, the property generally won't exist (deleted from node) if it is false. Please manually verify in your case using CRX-DE lite and examining the node & its properties. If the property does exist, but its value is false, then:
path=/content/site/my/path
type=cq:Page
property=#jcr:content/task/finished
property.value=false
For any still struggling, this is how you do it
path=/content/site/my/path
type=cq:Page
property=jcr:content/task/finished
property.operation=exists
property.value=false

SharePoint 2013 REST Query By ContentTypeId

I am trying to get all the folders items inside of a list. I know that folder content types start with 0x0120. So I wrote these two queries
http://sharepoint.com/sites/dev3/_api/web/lists/getbytitle('Discussions')/items?$filter=substringof(%270x0120%27,ContentTypeId)
This returns no results.
(this was a solution recommended in this thread OData substringof or startswith returning all items)
I also tried
http://sharepoint.com/sites/dev3/_api/web/lists/getbytitle('Discussions')/items?$startswith(%270x0120%27,ContentTypeId)
This returns results but it returns everything ... it does not really do the filtering based on the ID specified by me.
i also tried
http://sharepoint.com/sites/dev3/_api/web/GetFolderByServerRelativeUrl('/sites/dev3/lists/Discussions')/folders
This gives results... but does not return details like the Item Id which I need.
My end object is that if there is a list which has a folder called Foo and an Item called Bar. the query should fetch only the Foo folder and give me details like the etc.
I am looking for a REST solution (no CAML). so far the soltuions which I have tried either return everything Foo and Bar. or nothing.
Found the answer. putting it here so that it helps someone
web/lists/getbytitle('List)/items?$filter=startswith(ContentTypeId,'0x0120')

overpass api - requesting any node that has tag

I was wondering if it's possible to request via overpass API "any node that has at least one tag of any kind".
The only way I see right now is to sopecify all the existing tags in a huge union request (see below), or requesting nodes without the "tag filtering" at all, and getting many nodes that have no tag at all.
I will appreciate if you know a better solution.
Thanks!
[out:json];
(
node
["name"]
(50.6,7.0,50.8,7.3);
node
["amenity"]
(50.6,7.0,50.8,7.3);
AND SO ON (SPECIFY ALL THE OTHER TAGS)
);
out;
You can achieve this by using the following query:
[bbox:{{bbox}}];node[~"."~"."];out meta;
Example: http://overpass-turbo.eu/s/4Z4
Since version 0.7.54 you can also use the following approach:
[bbox:{{bbox}}];
node(if:count_tags() > 0);
out meta;
As far as I can see this is not possible at the moment. However you can post-filter the data using osmfilter / osmconvert.

Querying Google Analytics API for statistics for specific pages (filter by pages)

This query gives visits by traffic source;
https: //www.google.com/analytics/feeds/data?ids=ga%3A123456&dimensions=ga%3Asource%2Cga%3Amedium&metrics=ga%3Avisits&sort=-ga%3Avisits&start-date=2009-08-12&end-date=2009-08-26&max-results=50
But, when specifying a filter: ga:pagePath==/Default.aspx - I get zero results
https: //www.google.com/analytics/feeds/data?ids=ga%3A123456&dimensions=ga%3Asource%2Cga%3Amedium&metrics=ga%3Avisits&filters=ga%3ApagePath%3D%3D%2FDefault.aspx&sort=-ga%3Avisits&start-date=2009-08-12&end-date=2009-08-26&max-results=50
How can i filter on ga:pagePath?
query1.Dimensions = "ga:date,ga:pagepath"
query1.Metrics = "ga:pageviews"
query1.Sort = "ga:date,ga:pagepath"
query1.GAStartDate = "2010-09-01"
query1.GAEndDate = "2010-09-10"
query1.Filters = "ga:pagePath=~/abc*"
hope this works for you.
Here's a very late theory to your question...
Your data query looks valid assuming you have content indexed as /Default.aspx. I've reproduced the query on my asp.net site and get back results. I can see two potential scenarios where your query may produce empty results.
The filter mechanism in Analytics is case sensitive so if by chance links come into the page as default.aspx your filter for 'Default.aspx' won't hit. I wouldn't have guessed it works this way but lately I've had to go back and fix some of our queries as they produced empty results when case mismatches occurred.
The second possible issue relates to the use of 'Default Documents'. If links are coming into your site without a file name ('/' or '/somepath/') and 'default.aspx' is setup as a 'Default Document' in IIS, then you really want the filter to be ga:pagePath==/.