Package org.eclipse.viatra.query.patternlanguage.emf.util

## Class AdvancedPatternParser

- java.lang.Object
- - org.eclipse.viatra.query.patternlanguage.emf.util.BasePatternParser
  - - org.eclipse.viatra.query.patternlanguage.emf.util.AdvancedPatternParser

-     public class AdvancedPatternParser
      extends BasePatternParser

  An updateable, stateful pattern parser that allows the management of complex query libraries with interresource cross references.
  Since:
    2.1
  No Extend:
    This class is not intended to be subclassed by clients.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `AdvancedPatternParser.AdvancedPatternParserSnapshot` |

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.viatra.query.patternlanguage.emf.util.BasePatternParser

      `builder, extensionProvider, fileExtension, librarySpecifications, libraryURIs, manager, resourceFactory, resourceSet, SYNTHETIC_URI_PREFIX, validator`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `AdvancedPatternParser​(java.util.Set<IQuerySpecification<?>> librarySpecifications, java.util.Set<org.eclipse.emf.common.util.URI> libraryURIs, java.util.Optional<java.lang.ClassLoader> classloader)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected AdvancedPatternParser.AdvancedPatternParserSnapshot` | `addPatterns​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, java.util.Map<?,​?> options, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `AdvancedPatternParsingResults` | `addSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input)` | Parses the input as if they were multiple .vql files, and caches the contained queries for further use.
    `protected AdvancedPatternParsingResults` | `addSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, java.util.Map<?,​?> options, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `protected AdvancedPatternParsingResults` | `addSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `AdvancedPatternParsingResults` | `addSpecifications​(org.eclipse.emf.common.util.URI uriToUse, java.lang.String text)` |
    `protected java.util.Set<org.eclipse.emf.common.util.URI>` | `calculateImpact​(java.util.Set<org.eclipse.emf.common.util.URI> input)` |
    `protected java.util.Set<org.eclipse.emf.common.util.URI>` | `calculateImpact​(java.util.Set<org.eclipse.emf.common.util.URI> input, org.eclipse.emf.ecore.resource.ResourceSet rs)` | Deprecated. use `calculateImpact(Set)` instead, the resource set parameter is unnecessary
    `void` | `createResourceSet​(com.google.inject.Provider<org.eclipse.xtext.resource.XtextResourceSet> resourceSetProvider)` |
    `protected java.util.Set<org.eclipse.emf.common.util.URI>` | `getErroneousPatternResources​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, java.util.Set<org.eclipse.emf.common.util.URI> urisToIgnore)` |
    `java.util.Set<org.eclipse.xtext.validation.Issue>` | `getErrors​(org.eclipse.emf.common.util.URI uri)` |
    `java.util.Collection<org.eclipse.emf.common.util.URI>` | `getRegisteredURIs()` | Returns a collection of `URI`s that have been previously registered.
    `protected java.util.Map<org.eclipse.emf.common.util.URI,​PatternParsingResults>` | `parseBatch​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, java.util.Map<?,​?> options, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `protected void` | `processSpecifications​(AdvancedPatternParser.AdvancedPatternParserSnapshot results, AdvancedPatternParsingResults.AdvancedPatternParsingResultsBuilder builder)` |
    `protected AdvancedPatternParser.AdvancedPatternParserSnapshot` | `removePatterns​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, java.util.Map<?,​?> options, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `AdvancedPatternParsingResults` | `removeSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input)` | Removes the patterns provided in the input from the cache.
    `protected AdvancedPatternParsingResults` | `removeSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, java.util.Map<?,​?> options, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `protected AdvancedPatternParsingResults` | `removeSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `AdvancedPatternParsingResults` | `removeSpecifications​(org.eclipse.emf.common.util.URI uriToUse, java.lang.String text)` |
    `void` | `reset()` |
    `protected AdvancedPatternParser.AdvancedPatternParserSnapshot` | `updatePatterns​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, java.util.Map<?,​?> options, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `AdvancedPatternParsingResults` | `updateSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input)` | Parses the input as if they were multiple .vql files, and updates the cache based on the results.
    `protected AdvancedPatternParsingResults` | `updateSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, java.util.Map<?,​?> options, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `protected AdvancedPatternParsingResults` | `updateSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)` |
    `AdvancedPatternParsingResults` | `updateSpecifications​(org.eclipse.emf.common.util.URI uriToUse, java.lang.String text)` |

    - ### Methods inherited from class org.eclipse.viatra.query.patternlanguage.emf.util.BasePatternParser

      `enableReuseSpecificationBuilder, getAsStream, getOrCreateSpecificationBuilder, resource`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AdvancedPatternParser

          protected AdvancedPatternParser​(java.util.Set<IQuerySpecification<?>> librarySpecifications,
                                          java.util.Set<org.eclipse.emf.common.util.URI> libraryURIs,
                                          java.util.Optional<java.lang.ClassLoader> classloader)

      Since:
        2.4

  - ### Method Detail

    - #### createResourceSet

          public void createResourceSet​(com.google.inject.Provider<org.eclipse.xtext.resource.XtextResourceSet> resourceSetProvider)

      Overrides:
        `createResourceSet` in class `BasePatternParser`

    - #### addSpecifications

          protected AdvancedPatternParsingResults addSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                    java.util.Map<?,​?> options,
                                                                    org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### processSpecifications

          protected void processSpecifications​(AdvancedPatternParser.AdvancedPatternParserSnapshot results,
                                               AdvancedPatternParsingResults.AdvancedPatternParsingResultsBuilder builder)

    - #### updateSpecifications

          protected AdvancedPatternParsingResults updateSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                       java.util.Map<?,​?> options,
                                                                       org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### removeSpecifications

          protected AdvancedPatternParsingResults removeSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                       java.util.Map<?,​?> options,
                                                                       org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### addSpecifications

          protected AdvancedPatternParsingResults addSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                    org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### updateSpecifications

          protected AdvancedPatternParsingResults updateSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                       org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### removeSpecifications

          protected AdvancedPatternParsingResults removeSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                       org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### addSpecifications

          public AdvancedPatternParsingResults addSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input)

      Parses the input as if they were multiple .vql files, and caches the contained queries for further use. The produced query specifications can be later reused via referring their fully qualified names.
      Parameters:
        `input` - Map containing the input in textual form. Each synthetic .vql file must have a unique URI that can be used to identify its contents.
      Returns:
        `AdvancedPatternParsingResults` that contains the created `IQuerySpecification` objects.
      Throws:
        `java.lang.IllegalStateException` - if the input contains `URI` that has already been added.

    - #### addSpecifications

          public AdvancedPatternParsingResults addSpecifications​(org.eclipse.emf.common.util.URI uriToUse,
                                                                 java.lang.String text)

    - #### updateSpecifications

          public AdvancedPatternParsingResults updateSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input)

      Parses the input as if they were multiple .vql files, and updates the cache based on the results. Also updates any impacted, already existing `IQuerySpecification` objects. The produced query specifications can be later reused via referring their fully qualified names.
      Parameters:
        `input` - Map containing the input in textual form. Each synthetic .vql file must have a unique URI that can be used to identify its contents.
      Returns:
        `AdvancedPatternParsingResults` that contains the updated, and affected `IQuerySpecification` objects.
      Throws:
        `java.lang.IllegalStateException` - if the input contains `URI` that has not yet been added to the cache.

    - #### updateSpecifications

          public AdvancedPatternParsingResults updateSpecifications​(org.eclipse.emf.common.util.URI uriToUse,
                                                                    java.lang.String text)

    - #### removeSpecifications

          public AdvancedPatternParsingResults removeSpecifications​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input)

      Removes the patterns provided in the input from the cache. Also updates any impacted, already existing `IQuerySpecification` objects.
      Parameters:
        `input` - Map containing the input in textual form. Each synthetic .vql file must have a unique URI that can be used to identify its contents.
      Returns:
        `AdvancedPatternParsingResults` that contains removed, and affected `IQuerySpecification` objects.
      Throws:
        `java.lang.IllegalStateException` - if the input contains `URI` that has not yet been added to the cache.

    - #### removeSpecifications

          public AdvancedPatternParsingResults removeSpecifications​(org.eclipse.emf.common.util.URI uriToUse,
                                                                    java.lang.String text)

    - #### getRegisteredURIs

          public java.util.Collection<org.eclipse.emf.common.util.URI> getRegisteredURIs()

      Returns a collection of `URI`s that have been previously registered.

    - #### reset

          public void reset()

    - #### updatePatterns

          protected AdvancedPatternParser.AdvancedPatternParserSnapshot updatePatterns​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                                       java.util.Map<?,​?> options,
                                                                                       org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### addPatterns

          protected AdvancedPatternParser.AdvancedPatternParserSnapshot addPatterns​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                                    java.util.Map<?,​?> options,
                                                                                    org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### removePatterns

          protected AdvancedPatternParser.AdvancedPatternParserSnapshot removePatterns​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                                       java.util.Map<?,​?> options,
                                                                                       org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### calculateImpact

          @Deprecated
          protected java.util.Set<org.eclipse.emf.common.util.URI> calculateImpact​(java.util.Set<org.eclipse.emf.common.util.URI> input,
                                                                                   org.eclipse.emf.ecore.resource.ResourceSet rs)

      Deprecated.
      use `calculateImpact(Set)` instead, the resource set parameter is unnecessary

    - #### calculateImpact

          protected java.util.Set<org.eclipse.emf.common.util.URI> calculateImpact​(java.util.Set<org.eclipse.emf.common.util.URI> input)

      Since:
        2.2

    - #### parseBatch

          protected java.util.Map<org.eclipse.emf.common.util.URI,​PatternParsingResults> parseBatch​(java.util.Map<org.eclipse.emf.common.util.URI,​java.lang.String> input,
                                                                                                          java.util.Map<?,​?> options,
                                                                                                          org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

    - #### getErroneousPatternResources

          protected java.util.Set<org.eclipse.emf.common.util.URI> getErroneousPatternResources​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                                                                                java.util.Set<org.eclipse.emf.common.util.URI> urisToIgnore)

      Since:
        2.2

    - #### getErrors

          public java.util.Set<org.eclipse.xtext.validation.Issue> getErrors​(org.eclipse.emf.common.util.URI uri)

      Since:
        2.2