示例#1
0
文件: example.py 项目: onarf/Gaffer
def get_elements(gc):
    # Get Elements
    elements = gc.execute_operation(
        g.GetRelatedElements(
            seeds=[g.EntitySeed('1')],
            view=g.View(entities=[
                g.ElementDefinition(
                    group='entity',
                    transient_properties=[
                        g.Property('newProperty', 'java.lang.String')
                    ],
                    filter_functions=[
                        g.FilterFunction(
                            class_name='gaffer.function.simple.filter.IsEqual',
                            selection=[g.IdentifierKey('VERTEX')],
                            function_fields={'value': '1'})
                    ],
                    transform_functions=[
                        g.TransformFunction(
                            class_name=
                            'gaffer.rest.example.ExampleTransformFunction',
                            selection=[g.IdentifierKey('VERTEX')],
                            projection=[g.PropertyKey('newProperty')])
                    ])
            ],
                        edges=[g.ElementDefinition('edge')]),
            include_entities=False,
            include_edges=g.IncludeEdges.ALL))
    print('Related elements')
    print(elements)
    print()
示例#2
0
文件: example.py 项目: onarf/Gaffer
def generate_domain_objects_chain(gc):
    # Generate Domain Objects - chain of get elements then generate objects
    objects = gc.execute_operations([
        g.GetElementsBySeed(seeds=[g.EntitySeed('1')]),
        g.GenerateObjects('gaffer.rest.example.ExampleDomainObjectGenerator')
    ])
    print('Generated objects from get elements by seed')
    print(objects)
    print()
示例#3
0
文件: example.py 项目: onarf/Gaffer
def get_element_group_counts(gc):
    # Get Elements
    elements = gc.execute_operations([
        g.GetRelatedElements(seeds=[g.EntitySeed('1')]),
        g.CountGroups(limit=1000)
    ])
    print('Groups counts (limited to 1000 elements)')
    print(elements)
    print()
示例#4
0
文件: example.py 项目: onarf/Gaffer
def get_adj_seeds(gc):
    # Adjacent Elements - chain 2 adjacent entities together
    adjSeeds = gc.execute_operations([
        g.GetAdjacentEntitySeeds(seeds=[g.EntitySeed(vertex='1')],
                                 in_out_type=g.InOutType.OUT),
        g.GetAdjacentEntitySeeds(in_out_type=g.InOutType.OUT)
    ])
    print('Adjacent entities - 2 hop')
    print(adjSeeds)
    print()
示例#5
0
文件: example.py 项目: onarf/Gaffer
def get_sub_graph(gc):
    # Initialise, update and fetch an in memory set export
    result = gc.execute_operations([
        g.InitialiseSetExport(),
        g.GetAdjacentEntitySeeds(seeds=[g.EntitySeed('1')], ),
        g.UpdateExport(),
        g.GetAdjacentEntitySeeds(),
        g.UpdateExport(),
        g.FetchExport()
    ])
    print('Initialise, update and fetch export with adjacent entities')
    entity_seeds = g.ResultConverter.to_entity_seeds(result)
    print(entity_seeds)
    print()