This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Core: | |
http://localhost:8182/graphs/egosystem/core/addEntity | |
{ | |
entity: {uuid:'1234',name:'marko',type:'person'}, | |
identities : [ | |
{service:'twitter',handle:'@twarko',uri:'http://twitter.com/twarko'}, | |
{service:'lanl', handle:209893, uri:'http://people.lanl.gov/209893'} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vertex source = GraphUtilities.getThing(g, request.getString(Tokens.SOURCE_IDENTITY)); | |
Vertex target = GraphUtilities.getThing(g, request.getString(Tokens.TARGET_IDENTITY)); | |
final String keywordProperty = request.getString(Tokens.KEYWORD_PROPERTY); | |
def m = [:]; | |
source.out(Tokens.AUTHORED).in(Tokens.AUTHORED).loop(2) { it.loops < 4 & it.object != target }.simplePath.path.next(15).each { | |
for (int i = 1; i < it.size(); i = i + 2) { | |
it[i].out(Tokens.KEYWORD).property(keywordProperty).groupCount(m).iterate(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GetPathTagCloudExtensionTest extends TestCase { | |
static { | |
Gremlin.load(); | |
} | |
public void testCloud1() { | |
TransactionalGraph g = new TransactionalTinkerGraph(); | |
AddArticleExtension aa = new AddArticleExtension(); | |
JSONObject request = new JSONObject(''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExtensionNaming(namespace = "core", name = "getPathTagCloud") | |
class GetPathTagCloudExtension extends AbstractRexsterExtension { | |
static { | |
Gremlin.load(); | |
} | |
@ExtensionDefinition(extensionPoint = ExtensionPoint.GRAPH, method = HttpMethod.POST) | |
@ExtensionDescriptor(description = "Generate a keyword distribution of a path") | |
public ExtensionResponse evaluate(@RexsterContext RexsterResourceContext context, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testQuery() { | |
EgoSystemGraph g = new EgoSystemGraph(); | |
GetHomepageUriExtension gt = new GetHomepageUriExtension(); | |
JSONObject request = new JSONObject(''' | |
{ | |
person : 'Marko A. Rodriguez', | |
institution : 'Aurelius' | |
} | |
'''); | |
JSONObject result = gt.evaluate(new RexsterResourceContext(null, null, null, request, null, null, null), g).getJerseyResponse().getEntity(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!this.starts.hasNext()) { | |
for (final Map.Entry<K, Iterator<V>> entry : byMap.entrySet()) { | |
V2 previousReduceValue = this.reduceMap.get(entry.getKey()); | |
if (null == previousReduceValue) | |
this.reduceMap.put(entry.getKey(), reduceFunction.compute(entry.getValue())); | |
else | |
this.reduceMap.put(entry.getKey(), reduceFunction.compute(new MultiIterator(entry.getValue(), new SingleIterator(previousReduceValue)))); | |
} | |
this.byMap.clear(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tinkerpop.pipes.sideeffect; | |
import com.tinkerpop.pipes.PipeFunction; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
/** | |
* @author Marko A. Rodriguez (http://markorodriguez.com) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"properties":{ | |
"starttime":34543278387345, | |
"endtime":null, | |
"platonic":"person", | |
"name":"Rodriguez, Marko", | |
"locked":null | |
}, | |
"identities":[ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"properties":{ | |
"hindex":null, | |
"gindex":null, | |
"handle":null, | |
"longitude":null, | |
"logo":null, | |
"service":"msacademic", | |
"latitude":null, | |
"name":"Marko A. Rodriguez", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"properties":{ | |
"hindex":null, | |
"gindex":null, | |
"publicationcount":null, | |
"citationcount":null, | |
"handle":null, | |
"service":"msacademic", | |
"logo":null, | |
"longitude":null, |