GetGafferResultCacheExport
See javadoc - uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport
Available since Gaffer version 1.0.0
Fetches data from a Gaffer result cache
Required fields
No required fields
Examples
Simple export and get
Using this directed graph:
--> 4 <--
/ ^ \
/ | \
1 --> 2 --> 3
\
--> 5
Java
JSON
Full JSON
Python
final OperationChain<CloseableIterable<?>> opChain = new OperationChain.Builder()
.first(new GetAllElements())
.then(new ExportToGafferResultCache<>())
.then(new DiscardOutput())
.then(new GetGafferResultCacheExport())
.build();
{
"class" : "OperationChain",
"operations" : [ {
"class" : "GetAllElements"
}, {
"class" : "ExportToGafferResultCache"
}, {
"class" : "DiscardOutput"
}, {
"class" : "GetGafferResultCacheExport",
"key" : "ALL"
} ]
}
{
"class" : "uk.gov.gchq.gaffer.operation.OperationChain",
"operations" : [ {
"class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.DiscardOutput"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport",
"key" : "ALL"
} ]
}
g.OperationChain(
operations=[
g.GetAllElements(),
g.ExportToGafferResultCache(),
g.DiscardOutput(),
g.GetGafferResultCacheExport(
key="ALL"
)
]
)
Result:
Java
JSON
Edge[source=3,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>4]]
Entity[vertex=3,group=entity,properties=Properties[count=<java.lang.Integer>2]]
Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]]
Entity[vertex=2,group=entity,properties=Properties[count=<java.lang.Integer>1]]
Edge[source=1,destination=2,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=2,destination=3,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>2]]
Edge[source=2,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Edge[source=1,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]]
Edge[source=2,destination=5,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]
[ {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 3,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 4
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 3,
"properties" : {
"count" : 2
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 5,
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 2,
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 1,
"destination" : 2,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 3,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 2
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 1,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 4,
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 5,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 1,
"properties" : {
"count" : 3
}
} ]
Export and get job details
Using this directed graph:
--> 4 <--
/ ^ \
/ | \
1 --> 2 --> 3
\
--> 5
Java
JSON
Full JSON
Python
final OperationChain<JobDetail> opChain = new OperationChain.Builder()
.first(new GetAllElements())
.then(new ExportToGafferResultCache<>())
.then(new DiscardOutput())
.then(new GetJobDetails())
.build();
{
"class" : "OperationChain",
"operations" : [ {
"class" : "GetAllElements"
}, {
"class" : "ExportToGafferResultCache"
}, {
"class" : "DiscardOutput"
}, {
"class" : "GetJobDetails"
} ]
}
{
"class" : "uk.gov.gchq.gaffer.operation.OperationChain",
"operations" : [ {
"class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.DiscardOutput"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails"
} ]
}
g.OperationChain(
operations=[
g.GetAllElements(),
g.ExportToGafferResultCache(),
g.DiscardOutput(),
g.GetJobDetails()
]
)
Result:
Java
JSON
JobDetail[jobId=e4588792-dd64-4c52-adbf-881f61f60e87,user=User[userId=user01,dataAuths=[],opAuths=[]],status=RUNNING,startTime=1665484757211,opChain=OperationChain[GetAllElements->ExportToGafferResultCache->DiscardOutput->GetJobDetails]]
{
"jobId" : "e4588792-dd64-4c52-adbf-881f61f60e87",
"user" : {
"userId" : "user01",
"dataAuths" : [ ],
"opAuths" : [ ]
},
"status" : "RUNNING",
"startTime" : 1665484757211,
"opChain" : "OperationChain[GetAllElements->ExportToGafferResultCache->DiscardOutput->GetJobDetails]"
}
Get export
Using this directed graph:
--> 4 <--
/ ^ \
/ | \
1 --> 2 --> 3
\
--> 5
Java
JSON
Full JSON
Python
final OperationChain<CloseableIterable<?>> opChain = new OperationChain.Builder()
.first(new GetGafferResultCacheExport.Builder()
.jobId(jobDetail.getJobId())
.build())
.build();
{
"class" : "OperationChain",
"operations" : [ {
"class" : "GetGafferResultCacheExport",
"jobId" : "e4588792-dd64-4c52-adbf-881f61f60e87",
"key" : "ALL"
} ]
}
{
"class" : "uk.gov.gchq.gaffer.operation.OperationChain",
"operations" : [ {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport",
"jobId" : "e4588792-dd64-4c52-adbf-881f61f60e87",
"key" : "ALL"
} ]
}
g.OperationChain(
operations=[
g.GetGafferResultCacheExport(
job_id="e4588792-dd64-4c52-adbf-881f61f60e87",
key="ALL"
)
]
)
Result:
Java
JSON
Entity[vertex=2,group=entity,properties=Properties[count=<java.lang.Integer>1]]
Edge[source=2,destination=5,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]]
Edge[source=1,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=1,destination=2,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=3,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>4]]
Edge[source=2,destination=3,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>2]]
Entity[vertex=3,group=entity,properties=Properties[count=<java.lang.Integer>2]]
Edge[source=2,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]
[ {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 2,
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 5,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 4,
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 1,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 5,
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 1,
"destination" : 2,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 3,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 4
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 3,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 2
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 3,
"properties" : {
"count" : 2
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 1,
"properties" : {
"count" : 3
}
} ]
Export multiple results to gaffer result cache and get all results
Using this directed graph:
--> 4 <--
/ ^ \
/ | \
1 --> 2 --> 3
\
--> 5
Java
JSON
Full JSON
Python
final OperationChain<Map<String, CloseableIterable<?>>> opChain = new OperationChain.Builder()
.first(new GetAllElements())
.then(new ExportToGafferResultCache.Builder<>()
.key("edges")
.build())
.then(new DiscardOutput())
.then(new GetAllElements())
.then(new ExportToGafferResultCache.Builder<>()
.key("entities")
.build())
.then(new DiscardOutput())
.then(new GetExports.Builder()
.exports(new GetGafferResultCacheExport.Builder()
.key("edges")
.build(),
new GetGafferResultCacheExport.Builder()
.key("entities")
.build())
.build())
.build();
{
"class" : "OperationChain",
"operations" : [ {
"class" : "GetAllElements"
}, {
"class" : "ExportToGafferResultCache",
"key" : "edges"
}, {
"class" : "DiscardOutput"
}, {
"class" : "GetAllElements"
}, {
"class" : "ExportToGafferResultCache",
"key" : "entities"
}, {
"class" : "DiscardOutput"
}, {
"class" : "GetExports",
"getExports" : [ {
"class" : "GetGafferResultCacheExport",
"key" : "edges"
}, {
"class" : "GetGafferResultCacheExport",
"key" : "entities"
} ]
} ]
}
{
"class" : "uk.gov.gchq.gaffer.operation.OperationChain",
"operations" : [ {
"class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache",
"key" : "edges"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.DiscardOutput"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache",
"key" : "entities"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.DiscardOutput"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.GetExports",
"getExports" : [ {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport",
"key" : "edges"
}, {
"class" : "uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport",
"key" : "entities"
} ]
} ]
}
g.OperationChain(
operations=[
g.GetAllElements(),
g.ExportToGafferResultCache(
key="edges"
),
g.DiscardOutput(),
g.GetAllElements(),
g.ExportToGafferResultCache(
key="entities"
),
g.DiscardOutput(),
g.GetExports(
get_exports=[
g.GetGafferResultCacheExport(
key="edges"
),
g.GetGafferResultCacheExport(
key="entities"
)
]
)
]
)
Result:
Java
JSON
uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport: edges:
Edge[source=1,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=2,group=entity,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=2,destination=3,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>2]]
Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]]
Edge[source=1,destination=2,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>3]]
Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]]
Entity[vertex=3,group=entity,properties=Properties[count=<java.lang.Integer>2]]
Edge[source=2,destination=5,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Edge[source=3,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>4]]
Edge[source=2,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport: entities:
Edge[source=1,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=3,group=entity,properties=Properties[count=<java.lang.Integer>2]]
Edge[source=2,destination=5,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=3,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>4]]
Edge[source=2,destination=3,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>2]]
Edge[source=1,destination=2,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>3]]
Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=2,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]
Entity[vertex=2,group=entity,properties=Properties[count=<java.lang.Integer>1]]
{
"uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport: edges" : [ {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 1,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 2,
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 1,
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 3,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 2
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 4,
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 1,
"destination" : 2,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 5,
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 3,
"properties" : {
"count" : 2
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 5,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 3,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 4
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
} ],
"uk.gov.gchq.gaffer.operation.impl.export.resultcache.GetGafferResultCacheExport: entities" : [ {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 1,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 4,
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 3,
"properties" : {
"count" : 2
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 5,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 1,
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 3,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 4
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 3,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 2
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 1,
"destination" : 2,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 5,
"properties" : {
"count" : 3
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Edge",
"group" : "edge",
"source" : 2,
"destination" : 4,
"directed" : true,
"matchedVertex" : "SOURCE",
"properties" : {
"count" : 1
}
}, {
"class" : "uk.gov.gchq.gaffer.data.element.Entity",
"group" : "entity",
"vertex" : 2,
"properties" : {
"count" : 1
}
} ]
}