@Override
    public Graph<EntityDescriptor> resolveNativeEntity(EntityDescriptor entityDescriptor) {
        final MutableGraph<EntityDescriptor> mutableGraph = GraphBuilder.directed().build();
        mutableGraph.addNode(entityDescriptor);

        final ModelId modelId = entityDescriptor.id();
        try {
            final GrokPattern grokPattern = grokPatternService.load(modelId.id());

            final String namedPattern = grokPattern.pattern();
            final Set<String> patterns = GrokPatternService.extractPatternNames(namedPattern);
            patterns.stream().forEach(patternName -> {
                grokPatternService.loadByName(patternName).ifPresent(depPattern -> {
                    final EntityDescriptor depEntityDescriptor = EntityDescriptor.create(
                            depPattern.id(), ModelTypes.GROK_PATTERN_V1);
                    mutableGraph.putEdge(entityDescriptor, depEntityDescriptor);
                });
            });
        } catch (NotFoundException e) {
            LOG.debug("Couldn't find grok pattern {}", entityDescriptor, e);
        }
        return mutableGraph;
    }
@Test
    public void resolveMatchingDependecyForCreation() throws ValidationException {
        final GrokPattern noDepGrokPattern = grokPatternService.save(GrokPattern.create("HALFLIFE", "\\d\\d"));
        final EntityDescriptor noDepEntityDescriptor = EntityDescriptor.create(ModelId.of(noDepGrokPattern.id()),
                ModelTypes.GROK_PATTERN_V1);
        final GrokPattern depGrokPattern = grokPatternService.save(GrokPattern.create("PORTAL", "\\d\\d"));
        final EntityDescriptor depEntityDescriptor = EntityDescriptor.create(ModelId.of(depGrokPattern.id()),
                ModelTypes.GROK_PATTERN_V1);
        final GrokPattern grokPattern = grokPatternService.save(GrokPattern.create("Test", "%{PORTAL}"));
        final EntityDescriptor entityDescriptor = EntityDescriptor.create(ModelId.of(grokPattern.id()),
                ModelTypes.GROK_PATTERN_V1);

        Graph graph = facade.resolveNativeEntity(entityDescriptor);

        assertThat(graph.nodes().toArray()).contains(depEntityDescriptor);
        assertThat(graph.nodes().toArray()).doesNotContain(noDepEntityDescriptor);
    }