java.lang.Object
tools.refinery.interpreter.matchers.psystem.PBody
All Implemented Interfaces:
PTraceable

public class PBody extends Object implements PTraceable
A set of constraints representing a pattern body
  • Field Details

  • Constructor Details

    • PBody

      public PBody(PQuery query)
  • Method Details

    • getConstraintsOfType

      public <ConstraintType> Set<ConstraintType> getConstraintsOfType(Class<ConstraintType> constraintClass)
    • newVirtualVariable

      public PVariable newVirtualVariable()
    • newVirtualVariable

      public PVariable newVirtualVariable(String name)
    • newConstantVariable

      public PVariable newConstantVariable(Object value)
    • getAllVariables

      public Set<PVariable> getAllVariables()
    • getUniqueVariables

      public Set<PVariable> getUniqueVariables()
    • getVariableByNameChecked

      public PVariable getVariableByNameChecked(Object name)
      Find a PVariable by name
      Parameters:
      name -
      Returns:
      the found variable
      Throws:
      IllegalArgumentException - if no PVariable is found with the selected name
    • getOrCreateVariableByName

      public PVariable getOrCreateVariableByName(String name)
      Finds and returns a PVariable by name. If no PVariable exists with the name in the body, a new one is created. If the name of the variable starts with ".virtual", the created variable will be considered virtual.
      Parameters:
      name -
      Returns:
      a PVariable with the selected name; never null
    • getConstraints

      public Set<PConstraint> getConstraints()
    • getPattern

      public PQuery getPattern()
    • getSymbolicParameterVariables

      public List<PVariable> getSymbolicParameterVariables()
      Returns the symbolic parameters of the body.

      Warning: if two PVariables are unified, the returned list changes. If you want to have a stable version, consider using getSymbolicParameters().

      Returns:
      a non-null, but possibly empty list
    • getSymbolicParameters

      public List<ExportedParameter> getSymbolicParameters()
      Returns the exported parameter constraints of the body.
      Returns:
      a non-null, but possibly empty list
    • setSymbolicParameters

      public void setSymbolicParameters(List<ExportedParameter> symbolicParameters)
      Sets the exported parameter constraints of the body, if this instance is mutable.
      Parameters:
      symbolicParameters - the new value
    • setStatus

      public void setStatus(PQuery.PQueryStatus status)
      Sets a specific status for the body. If set, the parent PQuery status will not be checked; if set to null, its corresponding PQuery status is checked for mutability.
      Parameters:
      status - the status to set
    • isMutable

      public boolean isMutable()
    • getContainerDisjunction

      public PDisjunction getContainerDisjunction()
      Returns the disjunction the body is contained with. This disjunction may either be the canonical disjunction of the corresponding query or something equivalent.
      Returns:
      the container disjunction of the body. Can be null if body is not in a disjunction yet.
    • setContainerDisjunction

      public void setContainerDisjunction(PDisjunction containerDisjunction)
      Parameters:
      containerDisjunction - the containerDisjunction to set
    • getAllUnaryTypeRestrictions

      public Map<PVariable,Set<TypeJudgement>> getAllUnaryTypeRestrictions(IQueryMetaContext context)
      All unary input keys directly prescribed by constraints, grouped by variable.

      to supertype inference or subsumption applied at this point.