GReQL-Typegraph für Java

Aus JACK Wiki
Zur Navigation springen Zur Suche springen

Grundsätzlich folgt der Typegraph für GReQL-Queries zu Java der Java Language Specification für Java 8. Der Syntaxgraph wird durch den Eclipse-Parser erzeugt und verwendet die entsprechenden Namen für die Syntaxelemente. An einigen Stellen gibt es kleine Vereinfachungen und Erweiterungen.

Typegraph-Definitionen

Knotentypen

Alle Knoten erben vom abstrakten Typen Node. Zwei spezielle Knoten werden durch den Eclipse-Parser erzeugt und bilden die Wurzel und das erste Kind-Element des Syntaxbaumes.

abstract VertexClass Node;
VertexClass IJavaProject: Node { name:String };
VertexClass IPackageFragment: Node { name:String };

Alle Sprachelemente von Java erben von Element und erhalten darüber eine Zuordnung zu einer Zeilennummer.

abstract VertexClass Element: Node { line:Integer };
VertexClass AnonymousClassDeclaration:Element;
VertexClass CatchClause:Element;
VertexClass Comment:Element;
VertexClass CompilationUnit:Element { name:String };
VertexClass Dimension:Element;
VertexClass ImportDeclaration:Element { name:String, onDemand:Boolean, static:Boolean };
VertexClass Javadoc:Element;
VertexClass MemberRef:Element;
VertexClass MemberValuePair:Element;
VertexClass MethodRef:Element;
VertexClass MethodRefParameter:Element { varargs:Boolean };
VertexClass Modifier:Element { name:String };
VertexClass PackageDeclaration:Element { name:String };
VertexClass TagElement:Element { name:String };
VertexClass TextElement:Element { content:String };
VertexClass TypeParameter:Element;

Deklarationen innerhalb einer Klasse (im Gegensatz zu den oben enthaltenen Import-Deklarationen) erben vom Typ BodyDeclaration:

abstract VertexClass BodyDeclaration:Element;
VertexClass AnnotationTypeMemberDeclaration:BodyDeclaration;
VertexClass FieldDeclaration:BodyDeclaration;
VertexClass MethodDeclaration:BodyDeclaration { name:String, constructor:Boolean, dimension:Integer };
VertexClass EnumConstantDeclaration:BodyDeclaration;
VertexClass Initializer:BodyDeclaration;

Die Klassendekelartionen selber erben vom Typ AbstractTypeDeclaration:

abstract VertexClass AbstractTypeDeclaration:BodyDeclaration;
VertexClass AnnotationTypeDeclaration:AbstractTypeDeclaration;
VertexClass TypeDeclaration:AbstractTypeDeclaration { name:String, interface:Boolean };
VertexClass EnumDeclaration:AbstractTypeDeclaration;

In Typ-Referenzen kommen Unterklassen von Type zum Einsatz, ggf. auch von dessen Unterklasse AnnotatableType:

abstract VertexClass Type:Element;
VertexClass ArrayType:Type { dimensions:Integer };
VertexClass IntersectionType:Type;
VertexClass ParameterizedType:Type { name:String };
VertexClass UnionType:Type;
abstract VertexClass AnnotatableType:Type;
VertexClass PrimitiveType:AnnotatableType { name:String };
VertexClass SimpleType:AnnotatableType { name:String };
VertexClass QualifiedType:AnnotatableType { name:String };
VertexClass NameQualifiedType:AnnotatableType { name:String };
VertexClass WildcardType:AnnotatableType { upperBound:Boolean };

Variablen können einzeln oder als sogenanntes Fragment deklariert werden:

abstract VertexClass VariableDeclaration:Element;
VertexClass SingleVariableDeclaration:VariableDeclaration { name:String, varargs:Boolean, dimension:Integer };
VertexClass VariableDeclarationFragment:VariableDeclaration { name:String, dimension:Integer };

Alle Anweisungen erben von Statement:

abstract VertexClass Statement:Element;
VertexClass AssertStatement:Statement;
VertexClass Block:Statement;
VertexClass BreakStatement:Statement { name:String };
VertexClass ConstructorInvocation:Statement;
VertexClass ContinueStatement:Statement { name:String };
VertexClass DoStatement:Statement;
VertexClass EmptyStatement:Statement;
VertexClass EnhancedForStatement:Statement;
VertexClass ExpressionStatement:Statement;
VertexClass ForStatement:Statement;
VertexClass IfStatement:Statement;
VertexClass LabeledStatement:Statement;
VertexClass ReturnStatement:Statement;
VertexClass SuperConstructorInvocation:Statement;
VertexClass SwitchCase:Statement;
VertexClass SwitchStatement:Statement;
VertexClass SynchronizedStatement:Statement;
VertexClass ThrowStatement:Statement;
VertexClass TryStatement:Statement;
VertexClass TypeDeclarationStatement:Statement;
VertexClass VariableDeclarationStatement:Statement;
VertexClass WhileStatement:Statement;

Alle Ausdrücke erben von Expression:

abstract VertexClass Expression:Element;
VertexClass ArrayAccess:Expression;
VertexClass ArrayCreation:Expression;
VertexClass ArrayInitializer:Expression;
VertexClass Assignment:Expression { name:String };
VertexClass BooleanLiteral:Expression { content:String };
VertexClass CastExpression:Expression;
VertexClass CharacterLiteral:Expression { content:String };
VertexClass ClassInstanceCreation:Expression;
VertexClass ConditionalExpression:Expression;
VertexClass FieldAccess:Expression;
VertexClass InfixExpression:Expression { name:String };
VertexClass InstanceofExpression:Expression;
VertexClass LambdaExpression:Expression { parantheses:Boolean };
VertexClass MethodInvocation:Expression { name:String };
VertexClass NullLiteral:Expression;
VertexClass NumberLiteral:Expression { content:String };
VertexClass ParenthesizedExpression:Expression;
VertexClass PostfixExpression:Expression { name:String };
VertexClass PrefixExpression:Expression { name:String };
VertexClass StringLiteral:Expression { content:String };
VertexClass SuperFieldAccess:Expression;
VertexClass SuperMethodInvocation:Expression { name:String };
VertexClass ThisExpression:Expression;
VertexClass TypeLiteral:Expression;
VertexClass VariableDeclarationExpression:Expression;

In Variablen und Methoden-Referenzen kommen Unterklassen von Name zum Einsatz:

abstract VertexClass Name:Expression;
VertexClass SimpleName:Name { name:String };
VertexClass QualifiedName:Name;

Annotationen erben von Annotation:

abstract VertexClass Annotation:Expression;
VertexClass MarkerAnnotation:Annotation;
VertexClass NormalAnnotation:Annotation;
VertexClass SingleMemberAnnotation:Annotation;

Methoden-Referenzen erben von MethodReference:

abstract VertexClass MethodReference:Expression;
VertexClass CreationReference:MethodReference;
VertexClass ExpressionMethodReference:MethodReference;
VertexClass SuperMethodReference:MethodReference { name:String };
VertexClass TypeMethodReference:MethodReference { name:String };

Kantentypen

Die Verbindung zwischen Knoten hat auch jeweils einen Kantentyp, der sich aus den beteiligten Typen (oder ggf. deren Obertypen) ergibt. Alle Beziehungen sind als Eltern-Kind-Beziehung definiert, die die Baumstruktur abbildet. Hat ein Eltern-Knoten mehrere Kinder, sind diese entsprechend ihrer Reihenfolge im Code über ein Attribut der Kante durchnummeriert:

abstract EdgeClass Child from Node (0,1) to Node (0,*) { position:Integer } ;
EdgeClass AnnotationTypeDeclarationAnnotations:Child from AnnotationTypeDeclaration (1,1) to Annotation (0,*) role modifiers1;
EdgeClass AnnotationTypeDeclarationBodyDeclarations:Child from AnnotationTypeDeclaration (1,1) to AnnotationTypeMemberDeclaration (0,*) role bodyDeclarations;
EdgeClass AnnotationTypeDeclarationModifiers:Child from AnnotationTypeDeclaration (1,1) to Modifier (0,*) role modifiers2;
EdgeClass AnnotationTypeDeclarationName:Child from AnnotationTypeDeclaration (1,1) to SimpleName (0,1) role name;
EdgeClass AnnotationTypeMemberDeclarationAnnotations:Child from AnnotationTypeMemberDeclaration (1,1) to Annotation (0,*) role modifiers1;
EdgeClass AnnotationTypeMemberDeclarationDefault:Child from AnnotationTypeMemberDeclaration (1,1) to Expression (0,1) role default;
EdgeClass AnnotationTypeMemberDeclarationModifiers:Child from AnnotationTypeMemberDeclaration (1,1) to Modifier (0,*) role modifiers2;
EdgeClass AnnotationTypeMemberDeclarationName:Child from AnnotationTypeMemberDeclaration (1,1) to SimpleName (0,1) role name;
EdgeClass AnnotationTypeMemberDeclarationType:Child from AnnotationTypeMemberDeclaration (1,1) to Type (0,1) role type;
EdgeClass AnonymousClassDeclarationBodyDeclarations:Child from AnonymousClassDeclaration (1,1) to BodyDeclaration (0,*) role bodyDeclarations;
EdgeClass ArrayAccessArray:Child from ArrayAccess (1,1) to Expression (0,1) role array;
EdgeClass ArrayAccessIndex:Child from ArrayAccess (1,1) to Expression (0,1) role index;
EdgeClass ArrayCreationDimensions:Child from ArrayCreation (1,1) to Expression (0,*) role dimensions;
EdgeClass ArrayCreationInitializer:Child from ArrayCreation (1,1) to ArrayInitializer (0,1) role initializer;
EdgeClass ArrayCreationType:Child from ArrayCreation (1,1) to ArrayType (0,1) role type;
EdgeClass ArrayInitializerExpressions:Child from ArrayInitializer (1,1) to Expression (0,*) role expressions;
EdgeClass ArrayTypeComponentType:Child from ArrayType (1,1) to Type (0,1) role elementType;
EdgeClass AssertStatementMessage:Child from AssertStatement (1,1) to Expression (0,1) role message;
EdgeClass AssignmentLeftHandSide:Child from Assignment (1,1) to Expression (0,1) role leftHandSide;
EdgeClass AssignmentRightHandSide:Child from Assignment (1,1) to Expression (0,1) role rightHandSide;
EdgeClass BlockStatements:Child from Block (1,1) to Statement (0,*) role statements;
EdgeClass BodyDeclarationJavadoc:Child from BodyDeclaration (1,1) to Javadoc (0,1) role javadoc;
EdgeClass CastExpressionType:Child from CastExpression (1,1) to Type (0,1) role type;
EdgeClass CatchClauseBody:Child from CatchClause (1,1) to Block (0,*) role body;
EdgeClass CatchClauseException:Child from CatchClause (1,1) to SingleVariableDeclaration (0,*) role exception;
EdgeClass ClassInstanceCreationAnonymousClassDecl:Child from ClassInstanceCreation (1,1) to AnonymousClassDeclaration (0,1) role anonymousClassDeclaration;
EdgeClass ClassInstanceCreationArguments:Child from ClassInstanceCreation (1,1) to Expression (0,*) role arguments;
EdgeClass ClassInstanceCreationType:Child from ClassInstanceCreation (1,1) to Type (0,1) role type;
EdgeClass CompilationUnitImports:Child from CompilationUnit (1,1) to ImportDeclaration (0,*) role imports;
EdgeClass CompilationUnitPackage:Child from CompilationUnit (1,1) to PackageDeclaration (0,*) role package;
EdgeClass CompilationUnitTypes:Child from CompilationUnit (1,1) to AbstractTypeDeclaration (0,*) role types;
EdgeClass ConditionalExpressionElseExpression:Child from ConditionalExpression (1,1) to Expression (0,1) role elseExpression;
EdgeClass ConditionalExpressionThenExpression:Child from ConditionalExpression (1,1) to Expression (0,1) role thenExpression;
EdgeClass ConstructorInvocationArguments:Child from ConstructorInvocation (1,1) to Expression (0,*) role arguments;
EdgeClass ConstructorInvocationTypeArguments:Child from ConstructorInvocation (1,1) to Type (0,*) role typeArguments;
EdgeClass CreationReferenceTypeArguments:Child from CreationReference (1,1) to Type (0,*) role typeArguments;
EdgeClass CreationReferenceType:Child from CreationReference (1,1) to Type (0,1) role type;
EdgeClass DimensionAnnotations:Child from Dimension (1,1) to Annotation (0,*) role annotations;
EdgeClass DoStatementBody:Child from DoStatement (1,1) to Block (0,1) role body;
EdgeClass ElementExpression:Child from Element (1,1) to Expression (0,*) role expression;
EdgeClass EnhancedForStatementBody:Child from EnhancedForStatement (1,1) to Statement (0,1) role body;
EdgeClass EnhancedForStatementParameter:Child from EnhancedForStatement (1,1) to SingleVariableDeclaration (0,1) role parameter;
EdgeClass EnumConstantDeclarationAnonymousClassDeclaration:Child from EnumConstantDeclaration (1,1) to AnonymousClassDeclaration (0,1) role anonymousClassDeclaration;
EdgeClass EnumConstantDeclarationAnnotations:Child from EnumConstantDeclaration (1,1) to Annotation (0,*) role modifiers1;
EdgeClass EnumConstantDeclarationArguments:Child from EnumConstantDeclaration (1,1) to Expression (0,*) role arguments;
EdgeClass EnumConstantDeclarationModifiers:Child from EnumConstantDeclaration (1,1) to Modifier (0,*) role modifiers2;
EdgeClass EnumConstantDeclarationName:Child from EnumConstantDeclaration (1,1) to SimpleName (0,1) role name;
EdgeClass EnumDeclarationAnnotations:Child from EnumDeclaration (1,1) to Annotation (0,*) role modifiers1;
EdgeClass EnumDeclarationBodyDeclaration:Child from EnumDeclaration (1,1) to BodyDeclaration (0,*) role bodyDeclarations;
EdgeClass EnumDeclarationEnumConstants:Child from EnumDeclaration (1,1) to EnumConstantDeclaration (0,*) role enumConstants;
EdgeClass EnumDeclarationModifiers:Child from EnumDeclaration (1,1) to Modifier (0,*) role modifiers2;
EdgeClass EnumDeclarationName:Child from EnumDeclaration (1,1) to SimpleName (0,1) role name;
EdgeClass EnumDeclarationSuperInterfaceTypes:Child from EnumDeclaration (1,1) to Type (0,*) role superInterfaceTypes; 
EdgeClass ExpressionMethodReferenceArguments:Child from ExpressionMethodReference (1,1) to Type (0,*) role typeArguments;
EdgeClass ExpressionMethodReferenceName:Child from ExpressionMethodReference (1,1) to SimpleName (0,1) role name;
EdgeClass FieldAccessName:Child from FieldAccess (1,1) to SimpleName (0,1) role name;
EdgeClass FieldDeclarationAnnotation:Child from FieldDeclaration (1,1) to Annotation (0,*) role modifiers1;
EdgeClass FieldDeclarationFragments:Child from FieldDeclaration (1,1) to VariableDeclarationFragment (0,*) role fragments;
EdgeClass FieldDeclarationModifiers:Child from FieldDeclaration (1,1) to Modifier (0,*) role modifiers2;
EdgeClass FieldDeclarationType:Child from FieldDeclaration (1,1) to Type (0,1) role type;
EdgeClass ForStatementBody:Child from ForStatement (1,1) to Statement (0,1) role body;
EdgeClass ForStatementInitializers:Child from ForStatement (1,1) to Expression (0,*) role initializers;
EdgeClass ForStatementUpdaters:Child from ForStatement (1,1) to Expression (0,*) role updaters;
EdgeClass IfStatementElseStatement:Child from IfStatement (1,1) to Statement (0,1) role elseStatement;
EdgeClass IfStatementThenStatement:Child from IfStatement (1,1) to Statement (0,1) role thenStatement;
EdgeClass IJavaProjectFragements:Child from IJavaProject (1,1) to IPackageFragment (0,*) role fragments;
EdgeClass IJavaProjectUnits:Child from IJavaProject (1,1) to CompilationUnit (0,*) role units;
EdgeClass InfixExpressionExtendedOperands:Child from InfixExpression (1,1) to Expression (0,*) role extendedOperands;
EdgeClass InfixExpressionLeftOperand:Child from InfixExpression (1,1) to Expression (0,1) role leftOperand;
EdgeClass InfixExpressionRightOperand:Child from InfixExpression (1,1) to Expression (0,1) role rightOperand;
EdgeClass InitializerAnnotation:Child from Initializer (1,1) to Annotation (0,*) role modifiers1;
EdgeClass InitializerBody:Child from Initializer (1,1) to Block (0,1) role body;
EdgeClass InitializerModifiers:Child from Initializer (1,1) to Modifier(0,*) role modifiers2;
EdgeClass IntersectionTypeTypes:Child from IntersectionType (1,1) to Type (0,*) role types;
EdgeClass InstanceofExpressionLeftOperand:Child from InstanceofExpression (1,1) to Expression (0,1) role leftOperand;
EdgeClass InstanceofExpressionRightOperand:Child from InstanceofExpression (1,1) to Type (0,1) role rightOperand;
EdgeClass IPackageFragmentUnits:Child from IPackageFragment (1,1) to CompilationUnit (0,*) role units;
EdgeClass JavadocTags:Child from Javadoc (1,1) to TagElement (0,*) role tags;
EdgeClass LambdaExpressionBody:Child from LambdaExpression (1,1) to Element (0,1) role body;
EdgeClass LambdaExpressionParameters:Child from LambdaExpression (1,1) to VariableDeclaration (0,*) role parameters;
EdgeClass LabeledStatementBody:Child from LabeledStatement (1,1) to Statement (0,1) role body;
EdgeClass LabeledStatementLabel:Child from LabeledStatement (1,1) to SimpleName (0,1) role label;
EdgeClass MarkerAnnotationTypeName:Child from MarkerAnnotation (1,1) to SimpleName (0,*) role typeName;
EdgeClass MemberRefName:Child from MemberRef (1,1) to SimpleName (0,1) role name;
EdgeClass MemberRefQualifier:Child from MemberRef (1,1) to Name (0,1) role qualifier;
EdgeClass MemberValuePairName:Child from MemberValuePair (1,1) to SimpleName (0,1) role name;
EdgeClass MemberValuePairValue:Child from MemberValuePair (1,1) to Expression (0,1) role value;
EdgeClass MethodDeclarationAnnotation:Child from MethodDeclaration (1,1) to Annotation (0,*) role modifiers1;
EdgeClass MethodDeclarationBody:Child from MethodDeclaration (1,1) to Block (0,1) role body;
EdgeClass MethodDeclarationModifiers:Child from MethodDeclaration (1,1) to Modifier (0,*) role modifiers2;
EdgeClass MethodDeclarationParameters:Child from MethodDeclaration (1,1) to SingleVariableDeclaration (0,*) role parameters;
EdgeClass MethodDeclarationReceiverQualifier:Child from MethodDeclaration (1,1) to SimpleName (0,1) role receiverQualifier;
EdgeClass MethodDeclarationReceiverType:Child from MethodDeclaration (1,1) to Type (0,1) role receiverType;
EdgeClass MethodDeclarationReturnType:Child from MethodDeclaration (1,1) to Type (0,1) role returnType2;
EdgeClass MethodDeclarationThrownExceptions:Child from MethodDeclaration (1,1) to Type (0,*) role thrownExceptionTypes;
EdgeClass MethodDeclarationTypeParameters:Child from MethodDeclaration (1,1) to TypeParameter (0,*) role typeParameters;
EdgeClass MethodInvocationArguments:Child from MethodInvocation (1,1) to Expression (0,*) role arguments;
EdgeClass MethodRefName:Child from MethodRef (1,1) to SimpleName (0,1) role name;
EdgeClass MethodRefParameters:Child from MethodRef (1,1) to MethodRefParameter (0,*) role parameters;
EdgeClass MethodRefQualifier:Child from MethodRef (1,1) to Name (0,1) role qualifier;
EdgeClass MethodRefParameterName:Child from MethodRefParameter (1,1) to SimpleName (0,1) role name;
EdgeClass MethodRefParameterType:Child from MethodRefParameter (1,1) to Type (0,1) role type;
EdgeClass NormalAnnotationTypeName:Child from NormalAnnotation (1,1) to Name (0,1) role typeName;
EdgeClass NormalAnnotationValues:Child from NormalAnnotation (1,1) to MemberValuePair (0,*) role values;
EdgeClass ParameterizedTypeType:Child from ParameterizedType (1,1) to SimpleType (0,1) role type;
EdgeClass ParameterizedTypeTypeArguments:Child from ParameterizedType (1,1) to Type (0,*) role typeArguments;
EdgeClass PostfixExpressionOperand:Child from PostfixExpression (1,1) to SimpleName (0,1) role operand;
EdgeClass PrefixExpressionOperand:Child from PrefixExpression (1,1) to Expression (0,1) role operand;
EdgeClass QualifiedNameName:Child from QualifiedName (1,1) to SimpleName (0,1) role name;
EdgeClass QualifiedNameQualifier:Child from QualifiedName (1,1) to Name (0,1) role qualifier;
EdgeClass SimpleNameValues:Child from SimpleName (1,1) to MethodDeclaration (0,*) role values;
EdgeClass SimpleTypeAnnotation:Child from SimpleType (1,1) to Annotation (0,*) role annotations;
EdgeClass SimpleTypeName:Child from SimpleType (1,1) to Name (0,1) role name2;
EdgeClass SingleMemberAnnotationTypeName:Child from SingleMemberAnnotation (1,1) to SimpleName (0,1) role typeName;
EdgeClass SingleMemberAnnotationValue:Child from SingleMemberAnnotation (1,1) to Expression (0,1) role value;
EdgeClass SingleVariableDeclarationAnnotation:Child from SingleVariableDeclaration (1,1) to Annotation (0,*) role modifiers1;
EdgeClass SingleVariableDeclarationExtraDimensions:Child from SingleVariableDeclaration (1,1) to Dimension (0,*) role extraDimensions2;
EdgeClass SingleVariableDeclarationInitializer:Child from SingleVariableDeclaration (1,1) to Expression (0,1) role initializer;
EdgeClass SingleVariableDeclarationModifiers:Child from SingleVariableDeclaration (1,1) to Modifier (0,*) role modifiers2;
EdgeClass SingleVariableDeclarationType:Child from SingleVariableDeclaration (1,1) to Type (0,*) role type;
EdgeClass SingleVariableDeclarationVarargsAnnotations:Child from SingleVariableDeclaration (1,1) to Annotation (0,*) role varargsAnnotations;
EdgeClass SuperConstructorInvocationArgument:Child from SuperConstructorInvocation (1,1) to Expression (0,*) role arguments;
EdgeClass SuperConstructorInvocationTypeArguments:Child from SuperConstructorInvocation (1,1) to Type (0,*) role typeArguments;
EdgeClass SuperFieldAccessName:Child from SuperFieldAccess (1,1) to SimpleName (0,1) role name;
EdgeClass SuperFieldAccessQualifier:Child from SuperFieldAccess(1,1) to Name (0,1) role qualifier;
EdgeClass SuperMethodInvocationArguments:Child from SuperMethodInvocation (1,1) to Expression (0,*) role arguments;
EdgeClass SuperMethodInvocationQualifier:Child from SuperMethodInvocation (1,1) to Name (0,1) role qualifier;
EdgeClass SuperMethodReferenceArguments:Child from SuperMethodReference (1,1) to Type (0,*) role typeArguments;
EdgeClass SuperMethodReferenceQualifier:Child from SuperMethodReference (1,1) to Name (0,1) role qualifier;
EdgeClass SwitchStatementStatements:Child from SwitchStatement (1,1) to Statement (0,*) role statements;
EdgeClass SynchronizedStatementBlock:Child from SynchronizedStatement (1,1) to Block (0,1) role body;
EdgeClass TagElementFragments1:Child from TagElement (1,1) to TextElement (0,*) role fragments1;
EdgeClass TagElementFragments2:Child from TagElement (1,1) to Name (0,*) role fragments2;
EdgeClass TagElementFragments3:Child from TagElement (1,1) to MethodRef (0,*) role fragments3;
EdgeClass TagElementFragments4:Child from TagElement (1,1) to MemberRef (0,*) role fragments4;
EdgeClass TagElementFragments5:Child from TagElement (1,1) to TagElement (0,*) role fragments5;
EdgeClass ThisExpressionQualifier:Child from ThisExpression (1,1) to Name (0,1) role qualifier;
EdgeClass TryStatementBody:Child from TryStatement (1,1) to Statement (0,1) role body;
EdgeClass TryStatementCatchClauses:Child from TryStatement (1,1) to CatchClause (0,*) role catchClauses;
EdgeClass TryStatementFinally:Child from TryStatement (1,1) to Block (0,1) role finally;
EdgeClass TryStatementResources:Child from TryStatement (1,1) to VariableDeclarationExpression (0,*) role resources;
EdgeClass TypeDeclarationAnnotation:Child from TypeDeclaration (1,1) to Annotation (0,*) role modifiers2;
EdgeClass TypeDeclarationBodyDeclarations1:Child from TypeDeclaration (1,1) to BodyDeclaration (0,*) role bodyDeclarations;
EdgeClass TypeDeclarationModifiers:Child from TypeDeclaration (1,1) to Modifier (0,*) role modifiers1;
EdgeClass TypeDeclarationSuperclassType:Child from TypeDeclaration (1,1) to Type (0,1) role superclassType;
EdgeClass TypeDeclarationSuperInterfaceTypes:Child from TypeDeclaration (1,1) to Type (0,*) role superInterfaceTypes;
EdgeClass TypeDeclarationTypeParameters:Child from TypeDeclaration (1,1) to TypeParameter (0,*) role typeParameters;
EdgeClass TypeLiteralType:Child from TypeLiteral (1,1) to Type (0,1) role type;
EdgeClass TypeMethodReferenceArguments:Child from TypeMethodReference (1,1) to Type (0,*) role typeArguments;
EdgeClass TypeMethodReferenceType:Child from TypeMethodReference (1,1) to Type (0,1) role type;
EdgeClass TypeParameterName:Child from TypeParameter (1,1) to SimpleName (0,1) role name;
EdgeClass TypeParameterType:Child from TypeParameter (1,1) to Type (0,*) role typeBounds;
EdgeClass UnionTypeTypes:Child from UnionType (1,1) to Type (0,*) role types;
EdgeClass VariableDeclarationExpressionAnnotation:Child from VariableDeclarationExpression (1,1) to Annotation (0,*) role modifiers1;
EdgeClass VariableDeclarationExpressionFragments:Child from VariableDeclarationExpression (1,1) to VariableDeclarationFragment (0,*) role fragments;
EdgeClass VariableDeclarationExpressionModifiers:Child from VariableDeclarationExpression (1,1) to Modifier (0,*) role modifiers2;
EdgeClass VariableDeclarationExpressionType:Child from VariableDeclarationExpression (1,1) to Type (0,1) role type;
EdgeClass VariableDeclarationFragmentInitializer:Child from VariableDeclarationFragment (1,1) to Expression (0,1) role initializer;
EdgeClass VariableDeclarationStatementFragments:Child from VariableDeclarationStatement (1,1) to VariableDeclarationFragment (0,*) role fragments;
EdgeClass VariableDeclarationStatementModifier:Child from VariableDeclarationStatement (1,1) to Modifier (0,*) role modifiers;
EdgeClass VariableDeclarationStatementType:Child from VariableDeclarationStatement (1,1) to Type (0,1) role type;
EdgeClass WhileStatementBody:Child from WhileStatement (1,1) to Statement (0,1) role body;
EdgeClass WildcardTypeBound1:Child from WildcardType (1,1) to ParameterizedType (0,*) role bound1;
EdgeClass WildcardTypeBound2:Child from WildcardType (1,1) to SimpleType (0,*) role bound2;

JACK erzeugt zusätzliche Kanten vom Typ Access , mit denen vom Zugriff auf ein Element auf dessen Deklaration verwiesen wird. Diese Kanten sind nicht Teil des Syntaxbaumes, sondern erweitern ihn zu einem Graph. Sie stehen nur zur Verfügung, wenn Zugriff und Deklaration innerhalb des geparsten Codes liegen:

abstract EdgeClass Access from Node (0,1) to Node (0,*);
EdgeClass ExpressionAccess1:Access from Expression (1,1) to BodyDeclaration (0,*) role access1;
EdgeClass ExpressionAccess2:Access from Expression (1,1) to VariableDeclaration (0,*) role access2;
EdgeClass TypeAccess:Access from Type (1,1) to TypeDeclaration (0,*) role access;

Beispiel

Exemplarischer Code in Java:

public class Computer {

	public Computer(int price) {
		this.price = price;
	}

	private int price = 0;

	public int getPrice() {
		return price;
	}

	public static Computer[] getSortedByPrice(Computer[] computers) {
		for (int n = computers.length; n > 1; n--) {
			for (int i = 0; i < n - 1; i++) {
				if (computers[i].price > computers[i + 1].price) {
					Computer swapComputer = computers[i + 1];
					computers[i + 1] = computers[i];
					computers[i] = swapComputer;
				}
			}
		}
		return computers;
	}
}

Zugehöriger Syntaxgraph:

Syntaxgraph-computer.png