AST Extension Ontology 1.0

Universal AST types and extensions for cross-language analysis. Maps language-specific tree-sitter nodes to generic ast-x: classes via rdfs:subClassOf.

522 triples · Download .ttl · 25 classes · 2 object properties · 18 datatype properties

Classes (25)

ClassSubclass OfDescription
ast-x:Assignment Direct value assignment: x = expr. Includes walrus operator := (Python), Go short_var_declaration.
ast-x:AugmentedAssignment Compound assignment: +=, -=, *=, /=, etc. Reads and writes the same variable.
ast-x:BreakStatement Early exit: break (exits loop or switch), fallthrough (Go).
ast-x:CallSite Any function call, method call, or constructor invocation. PRIMARY input for multilspy: each call_site is sent as a DefinitionRequest to resolve the target.
ast-x:CatchClause Exception handler: catch, except, rescue.
ast-x:ClassDefinition Any class, interface, struct, enum, trait, or module definition. Includes impl blocks (Rust) and type declarations (Go).
ast-x:Comment Any comment node in the AST: line comments, block comments, doc comments. Provides context for LLM analysis. Documentation content is available via LSP hover for doc comments.
ast-x:ContinueStatement Skip to next iteration: continue, next (Ruby), redo (Ruby).
ast-x:ElseClause Default branch when no condition matches. NOT a decision point - does not contribute to cyclomatic complexity. Separated from ast-x:IfStatement to avoid inflating complexity counts.
ast-x:ExtendsClause Superclass/parent class declaration. Single inheritance (Java, Ruby) or primary base class (C++, Python). Used to identify class hierarchies.
ast-x:ForStatement For loop: for-in, for-each, enhanced-for, range-based for. Iterator-driven.
ast-x:FunctionDefinition Any function, method, constructor, lambda, or closure definition. Used by multilspy to find all references.
ast-x:IfStatement Conditional branch: if, elif, unless, guard, if-modifier. Each represents a decision point for cyclomatic complexity.
ast-x:ImplementsClause Interface implementation declaration. Maps to implements (Java, TypeScript), trait bounds (Rust), protocols (Swift).
ast-x:ImportStatement Any import, use, require, or include directive. Used by multilspy to resolve module paths and cross-file symbol origins.
ast-x:InheritanceSpecifier General inheritance/delegation declaration. Includes delegation (Kotlin), trait bounds (Rust), interface embedding (Go).
ast-x:Parameter Individual parameter within a function/method signature. Covers required, optional, typed, default, variadic, and destructured parameters. Children of an ast-x:ParameterList.
ast-x:ParameterList Container node holding all parameters in a function/method signature. Use ast-x:parameterIndex on child ast-x:Parameter nodes to track position.
ast-x:ReturnStatement Exit function with optional value: return, co_return (C++20).
ast-x:SwitchStatement Multi-way dispatch: switch, match, case, when.
ast-x:ThrowStatement Raise an exception: throw, raise.
ast-x:TryStatement Exception handling scope: try, try-with-resources (Java), begin (Ruby).
ast-x:VariableDeclaration Introduces a new variable binding: let, var, const, short_var_declaration (:= in Go).
ast-x:WhileStatement Condition-driven loop: while, do-while, loop (Rust), until (Ruby).
ast-x:YieldStatement Generator/coroutine yield: yield, yield_expression, co_yield.

Object Properties (2)

PropertyDomainRangeDescription
ast-x:resolutionNode ast:Node Points from an import statement to the specific child node containing the module/symbol name, extracted via tree-sitter .scm query at blob parse time. The child node has the correct position for LSP r...
ast-x:sourceBlobNode ast:Node ast:Node Points to the blob node that contains this AST node's source code. Links AST nodes back to their containing blob for retrieval and reference (e.g., <blob/abc123#node_42_1_50_2>).

Datatype Properties (18)

PropertyDomainRangeDescription
ast-x:assignmentCount xsd:nonNegativeInteger Count of assignment operations in the function. High values indicate mutation-heavy code. NOT YET IMPLEMENTED. To implement: Count nodes that are subclasses of ast-x:Assignment or ast-x:AugmentedAssig...
ast-x:assignsTo ast:Node xsd:string Target variable name for assignment operations. Extracted from the left-hand side (field_left) of assignment nodes during blob parsing. For simple assignments only; complex targets (destructuring, fie...
ast-x:branchCount xsd:nonNegativeInteger Count of if/switch statements in the function. NOT YET IMPLEMENTED. To implement: Count nodes that are subclasses of ast-x:IfStatement or ast-x:SwitchStatement within function body.
ast-x:cyclomaticComplexity xsd:nonNegativeInteger McCabe cyclomatic complexity: count of decision points + 1. Higher values indicate more complex control flow. NOT YET IMPLEMENTED. To implement: During AST traversal, count decision point nodes (if_st...
ast-x:docstring ast:Node xsd:string Documentation text attached to a function, class, or module. Extracted from the first ast-x:Comment child of an ast-x:FunctionDefinition or ast-x:ClassDefinition during parse time. Used for documentat...
ast-x:exceptionHandlerCount xsd:nonNegativeInteger Count of try/catch blocks in the function. NOT YET IMPLEMENTED. To implement: Count nodes that are subclasses of ast-x:TryStatement within function body.
ast-x:fieldCount xsd:nonNegativeInteger Number of fields/properties in a class. NOT YET IMPLEMENTED. To implement: Count field/property declaration nodes within class body. Language-specific patterns needed (field_declaration, property_decl...
ast-x:filePath ast:Node xsd:string Repository-relative file path for this AST node (e.g., 'src/main.js', 'lib/utils/helper.py'). Used to locate the source file within the repository structure.
ast-x:hasDocumentation xsd:boolean Whether this symbol has documentation comments (JSDoc, docstring, JavaDoc, etc.). Used for documentation coverage analysis. NOT YET IMPLEMENTED. To implement: During AST traversal, check for doc comme...
ast-x:isOptional ast:Node xsd:boolean Whether this parameter is optional/has a default value. Detected via .scm queries looking for: TypeScript '?' suffix, Python/Kotlin default values, etc. Populated during blob parsing.
ast-x:lineCount xsd:nonNegativeInteger Number of lines spanned by this entity (endLine - startLine + 1). NOT YET IMPLEMENTED. To implement: Use ast:endRow - ast:startRow + 1 from tree-sitter node.
ast-x:localVariableCount xsd:nonNegativeInteger Number of local variable declarations in the function. NOT YET IMPLEMENTED. To implement: Count nodes that are subclasses of ast-x:VariableDeclaration within function body (excluding parameters and cl...
ast-x:loopCount xsd:nonNegativeInteger Count of for/while loops in the function. NOT YET IMPLEMENTED. To implement: Count nodes that are subclasses of ast-x:ForStatement or ast-x:WhileStatement within function body.
ast-x:methodCount xsd:nonNegativeInteger Number of methods in a class. NOT YET IMPLEMENTED. To implement: Count child nodes that are subclasses of ast-x:FunctionDefinition within class body.
ast-x:nestingDepth xsd:nonNegativeInteger Maximum depth of nested control flow structures. Deep nesting indicates harder-to-understand code. NOT YET IMPLEMENTED. To implement: During AST traversal, track current depth counter. Increment when ...
ast-x:parameterCount xsd:nonNegativeInteger Number of parameters for a function/method. NOT YET IMPLEMENTED. To implement: Count child nodes that are subclasses of ast-x:Parameter within function definition.
ast-x:parameterIndex ast:Node xsd:nonNegativeInteger Zero-indexed position of this parameter in the function signature. Computed during AST traversal by counting parameter positions. Used for argument-to-parameter dataflow mapping.
ast-x:returnCount xsd:nonNegativeInteger Number of return statements in the function. Multiple returns can indicate complex control flow. NOT YET IMPLEMENTED. To implement: Count nodes that are subclasses of ast-x:ReturnStatement within func...