All Downloads are FREE. Search and download functionalities are using the official Maven repository.

schemas.base.json Maven / Gradle / Ivy

// Schema for the base code property graph
// Language modules are required to produce graphs adhering to this schema
{

    // Keys for node properties

    "nodeKeys" : [

        { "id": 19, "name" : "LANGUAGE", "comment" : "The programming language this graph originates from", "valueType" : "string", "cardinality" : "one"},
        { "id" : 13, "name": "VERSION", "comment" : "A version, given as a string", "valueType" : "string", "cardinality" : "one"},

        // Properties that indicate where the code can be found

        {"id" : 2, "name": "LINE_NUMBER", "comment": "Line where the code starts", "valueType" : "int", "cardinality" : "zeroOrOne"},
        {"id" : 10, "name": "LINE_NUMBER_END", "comment" : "Line where the code ends", "valueType" : "int", "cardinality" : "zeroOrOne" },
        {"id" : 11, "name": "COLUMN_NUMBER", "comment" : "Column where the code starts", "valueType" : "int", "cardinality" : "zeroOrOne" },
        {"id" : 12, "name": "COLUMN_NUMBER_END", "comment" : "Column where the code ends", "valueType" : "int", "cardinality" : "zeroOrOne" },

        {"id" : 3, "name": "PARSER_TYPE_NAME", "comment": "Type name emitted by parser, only present for logical type  UNKNOWN", "valueType" : "string", "cardinality" : "one"},
        {"id" : 4, "name": "ORDER", "comment": "General ordering property. E.g. used to express the ordering of children in the AST.", "valueType" : "int", "cardinality" : "one"},
        {"id" : 40, "name": "ARGUMENT_INDEX", "comment": "The index of a call argument. This is used for the association between arguments and parameters. This property is different from ORDER for named arguments because of the required reordering to align arguments with parameters.", "valueType" : "int", "cardinality" : "one"},

        {"id" : 7, "name": "IS_EXTERNAL", "comment" : "Indicates that the construct is external, that is, it is referenced but not defined in the code", "valueType" : "boolean", "cardinality" : "one"},

        // String properties for various types of nodes

        {"id" : 5, "name": "NAME", "comment": "Name of represented object, e.g., method name", "valueType" : "string", "cardinality" : "one"},
        {"id" : 6, "name": "FULL_NAME", "comment" : "Full name of an element, e.g., the class name along, including its package.", "valueType" : "string", "cardinality" : "one"},
        {"id": 21, "name": "CODE", "comment": "The code snippet the node represents", "valueType" : "string", "cardinality" : "one"},
        {"id": 22, "name": "SIGNATURE", "comment": "Method signature", "valueType" : "string", "cardinality" : "one"},
        { "id": 26, "name" : "MODIFIER_TYPE", "comment" : "Indicates the which modifier is represented by a MODIFIER node. See modifierTypes.", "valueType" : "string", "cardinality" : "one"},

        // Properties to characterize call-sites

        {"id": 25, "name": "DISPATCH_TYPE", "comment": "The dispatch type of a call, which is either static or dynamic. See dispatchTypes.", "valueType" : "string", "cardinality" : "one"},
        {"id": 15, "name" : "EVALUATION_STRATEGY", "comment" : "Evaluation strategy for function parameters and return values. One of the values in \"evaluationStrategies\".", "valueType" : "string", "cardinality" : "one"},

        // Properties used to link nodes in the backend
        {"id": 50, "name" : "CLOSURE_BINDING_ID", "comment" : "Identifier which uniquely describes a CLOSURE_BINDING. This property is used to match captured LOCAL nodes with the corresponding CLOSURE_BINDING nodes.", "valueType" : "string", "cardinality" : "zeroOrOne"},
        {"id": 51, "name" : "TYPE_FULL_NAME", "comment" : "The static type of an entity. E.g. expressions, local, parameters etc. This property is matched against the FULL_NAME of TYPE nodes and thus it is required to have at least one TYPE node for each TYPE_FULL_NAME.", "valueType" : "string", "cardinality" : "one"},
        {"id": 52, "name" : "TYPE_DECL_FULL_NAME", "comment" : "The static type decl of a TYPE. This property is matched against the FULL_NAME of TYPE_DECL nodes. It is required to have exactly one TYPE_DECL for each different TYPE_DECL_FULL_NAME.", "valueType" : "string", "cardinality" : "one"},
        {"id": 53, "name" : "INHERITS_FROM_TYPE_FULL_NAME", "comment" : "The static types a TYPE_DECL inherits from. This property is matched against the FULL_NAME of TYPE nodes and thus it is required to have at least one TYPE node for each TYPE_FULL_NAME.", "valueType" : "string", "cardinality" : "list"},
        {"id": 54, "name" : "METHOD_FULL_NAME", "comment" : "The FULL_NAME of a method. Used to link METHOD_INST and METHOD nodes. It is required to have exactly one METHOD node for each METHOD_FULL_NAME.", "valueType" : "string", "cardinality" : "one"},
        {"id": 55, "name" : "METHOD_INST_FULL_NAME", "comment" : "The FULL_NAME of a method instance. Used to link CALL and METHOD_REF nodes to METHOD_INST nodes. There needs to be at least one METHOD_INST node for each METHOD_INST_FULL_NAME.", "valueType" : "string", "cardinality" : "one"},
        {"id": 56, "name" : "AST_PARENT_TYPE", "comment" : "The type of the AST parent. Since this is only used in some parts of the graph the list does not include all possible parents by intention. Possible parents: METHOD, TYPE_DECL, NAMESPACE_BLOCK.", "valueType" : "string", "cardinality" : "one"},
        {"id": 57, "name" : "AST_PARENT_FULL_NAME", "comment" : "The FULL_NAME of a the AST parent of an entity.", "valueType" : "string", "cardinality" : "one"}
    ],

    // Keys for edge properties

    "edgeKeys" : [
      {"id" : 6, "name" : "LOCAL_NAME", "comment" : "localName of referenced CONTAINED node", "valueType" : "string", "cardinality" : "zeroOrOne"},
      {"id" : 7, "name" : "CONDITION", "comment" : "The condition result under which a CFG edge is followed.", "valueType" : "boolean", "cardinality" : "zeroOrOne"},
      {"id" : 8, "name" : "INDEX", "comment" : "index of referenced CONTAINED node (0 based) - used together with cardinality=list", "valueType" : "int", "cardinality" : "zeroOrOne"}
    ],

    // Types of nodes

    "nodeTypes" : [
        {
            "id" : 39,
            "name" : "META_DATA",
            "keys" : ["LANGUAGE", "VERSION"],
            "comment" : "Node to save meta data about the graph on its properties. Exactly one node of this type per graph.",
            "outEdges" : []
        },
        // Nodes describing program structure

        {"id" : 38,
         "name": "FILE",
         "keys": ["NAME"],
         "comment": "Node presenting a source file. Often also the AST root.",
         "outEdges": [
             {"edgeName": "AST", "inNodes": ["NAMESPACE_BLOCK"]}
         ]
        },

        // Nodes of method declarations

        {"id" : 1, "name" : "METHOD",
         "keys": ["NAME", "FULL_NAME", "SIGNATURE", "AST_PARENT_TYPE", "AST_PARENT_FULL_NAME",
           "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment" : "A method/function/procedure",
         "is": ["DECLARATION"],
         "outEdges" : [
             {"edgeName": "AST", "inNodes": ["METHOD_RETURN", "METHOD_PARAMETER_IN",
                                             "MODIFIER", "BLOCK", "TYPE_PARAMETER"]},
             {"edgeName": "CFG", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "METHOD_REF", "RETURN", "UNKNOWN"]}
         ]
        },

        {"id" : 34, "name" : "METHOD_PARAMETER_IN",
         "keys": ["CODE", "ORDER", "NAME", "EVALUATION_STRATEGY", "TYPE_FULL_NAME", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment" : "This node represents a formal parameter going towards the callee side.",
         "is": ["DECLARATION", "DATA_FLOW_OBJECT", "LOCAL_LIKE"]
        },

        {"id" : 3, "name" : "METHOD_RETURN",
         "keys": ["CODE", "EVALUATION_STRATEGY", "TYPE_FULL_NAME", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment" : "A formal method return",
         "is": ["DATA_FLOW_OBJECT"]
        },

        // Modifier

        {"id" : 300, "name" : "MODIFIER",
         "keys" : ["MODIFIER_TYPE"],
         "comment" : "The static-modifier",
         "outEdges": []
        },

        // Types

        {"id" : 45, "name" : "TYPE",
         "keys" : ["NAME", "FULL_NAME", "TYPE_DECL_FULL_NAME"],
         "comment" : "A type which always has to reference a type declaration and may have type argument children if the refered type declaration is a template.",
         "outEdges" : [
             {"edgeName": "AST", "inNodes": ["TYPE_ARGUMENT"]}
         ]
        },
        {"id" : 46, "name" : "TYPE_DECL",
         "keys" : ["NAME", "FULL_NAME", "IS_EXTERNAL", "INHERITS_FROM_TYPE_FULL_NAME", "AST_PARENT_TYPE", "AST_PARENT_FULL_NAME"],
         "comment" : "A type declaration.",
         "outEdges" : [
             {"edgeName": "AST", "inNodes": ["TYPE_PARAMETER", "MEMBER", "MODIFIER"]},
             {"edgeName": "VTABLE", "inNodes": ["METHOD"]}
         ]
        },
        {"id" : 47, "name" : "TYPE_PARAMETER",
         "keys" : ["NAME", "ORDER"],
         "comment" : "Type parameter of TYPE_DECL or METHOD.",
         "outEdges" : []
        },
        {"id" : 48, "name" : "TYPE_ARGUMENT",
         "keys" : [],
         "comment" : "Argument for a TYPE_PARAMETER and belonging to a TYPE or METHOD_INST. It binds another TYPE to a TYPE_PARAMETER.",
         "outEdges" : [
             {"edgeName": "REF", "inNodes": ["TYPE"]},
             {"edgeName": "BINDS_TO", "inNodes": ["TYPE_PARAMETER"]}
         ]
        },

        {"id" : 9, "name" : "MEMBER",
         "keys" : [ "CODE", "NAME", "TYPE_FULL_NAME"],
         "comment" : "Member of a class struct or union",
         "is": ["DECLARATION"]
        },

        {
            "id":41,
            "name": "NAMESPACE_BLOCK",
            "keys": ["NAME", "FULL_NAME"],
            "comment": "A reference to a namespace."
        },

        // Nodes that describe method content

        {"id" : 8, "name" : "LITERAL",
         "keys" : ["CODE", "NAME", "ORDER", "ARGUMENT_INDEX", "TYPE_FULL_NAME", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment" : "Literal/Constant",
         "is": ["DECLARATION", "DATA_FLOW_OBJECT", "EXPRESSION"],
         "outEdges" : [
             {"edgeName": "CFG", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "METHOD_REF", "RETURN", "UNKNOWN"]}
         ]
        },
        {"id": 15, "name" : "CALL",
         "keys": ["CODE", "NAME", "ORDER", "ARGUMENT_INDEX", "DISPATCH_TYPE", "SIGNATURE", "TYPE_FULL_NAME", "METHOD_INST_FULL_NAME", "LINE_NUMBER",
                  "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment" : "A (method)-call",
         "is": ["EXPRESSION"],
         "outEdges" : [
             {"edgeName": "CFG", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "METHOD_REF", "RETURN", "UNKNOWN"]},
             {"edgeName": "AST", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "METHOD_REF"]}
         ]
        },
        {"id":23, "name" : "LOCAL",
         "keys": ["CODE", "NAME", "CLOSURE_BINDING_ID", "TYPE_FULL_NAME", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment": "A local variable",
         "is": ["DECLARATION", "LOCAL_LIKE"]
        },
        {"id":27, "name": "IDENTIFIER",
         "keys": ["CODE", "NAME", "ORDER", "ARGUMENT_INDEX", "TYPE_FULL_NAME", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment" : "An arbitrary identifier/reference.",
         "is": ["DATA_FLOW_OBJECT", "EXPRESSION", "LOCAL_LIKE"],
         "outEdges" : [
             {"edgeName": "REF", "inNodes": ["LOCAL"]},
             {"edgeName": "CFG", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "METHOD_REF", "RETURN", "UNKNOWN"]}
         ]
        },
        {"id":30, "name": "RETURN",
         "keys": [ "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END", "ORDER", "ARGUMENT_INDEX", "CODE"],
         "comment" : "A return instruction.",
         "is": [ "EXPRESSION" ],
         "outEdges" : [
             {"edgeName": "AST", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "METHOD_REF"]},
             {"edgeName": "CFG", "inNodes": ["METHOD_RETURN"]}
         ]
        },
        {"id":31, "name": "BLOCK",
         "keys": [ "ORDER", "ARGUMENT_INDEX", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment" : "A structuring block in the AST.",
         "outEdges" : [
             {"edgeName": "AST", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "METHOD_REF", "RETURN", "LOCAL", "UNKNOWN"]}
         ]
        },
        {"id":32, "name":"METHOD_INST",
         "keys":["NAME", "FULL_NAME", "SIGNATURE", "METHOD_FULL_NAME"],
         "comment":"A method instance which always has to reference a method and may have type argument children if the refered method is a template.",
         "outEdges": [
             {"edgeName": "AST", "inNodes": ["TYPE_ARGUMENT"]}
         ]
        },

        {"id" : 14, "name" : "ARRAY_INITIALIZER",
         "keys":[],
         "outEdges": [],
         "comment" : "Initialization contruct for arrays."
        },

        {"id":333, "name":"METHOD_REF",
          "keys": ["CODE", "ORDER", "ARGUMENT_INDEX", "METHOD_INST_FULL_NAME", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
          "comment":"Reference to a method instance.",
         "is": ["EXPRESSION"],
          "outEdges": [
            {"edgeName": "CFG", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "METHOD_REF", "RETURN", "UNKNOWN"]}
          ]
        },


        // This is the "catch-all-others" node type.

        {"id" : 44, "name": "UNKNOWN",
         "keys" : ["CODE", "PARSER_TYPE_NAME", "ORDER", "ARGUMENT_INDEX", "TYPE_FULL_NAME", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"],
         "comment" : "A language-specific node",
         "is": ["EXPRESSION"],
         "outEdges" : [
             {"edgeName": "CFG", "inNodes": ["CALL", "IDENTIFIER", "LITERAL", "RETURN", "METHOD_REF"]},
             {"edgeName": "AST", "inNodes": ["LITERAL", "MEMBER",
                                             "MODIFIER", "ARRAY_INITIALIZER", "CALL", "LOCAL",
                                             "IDENTIFIER", "RETURN", "BLOCK", "METHOD_INST", "UNKNOWN"]}
         ]
        }
    ],

    // common base traits for nodes
    "nodeBaseTraits" : [
      { "name" : "DECLARATION", "comment" : "", "hasKeys" : ["NAME"]},
      { "name" : "DATA_FLOW_OBJECT", "comment" : "anything that can appear inside a data flow", "hasKeys" : ["CODE", "LINE_NUMBER", "LINE_NUMBER_END", "COLUMN_NUMBER", "COLUMN_NUMBER_END"]},
      { "name" : "EXPRESSION", "comment" : "expression as a specialisation of data flow objects", "hasKeys" : ["ORDER"], "extends" : "DATA_FLOW_OBJECT"},
      { "name" : "LOCAL_LIKE", "comment" : "", "hasKeys" : ["NAME"]}
    ],

    "edgeTypes" : [

        {"id" : 3, "name" : "AST", "comment" : "Syntax child" , "keys" : [] },
        {"id" : 19, "name" : "CFG", "comment" : "Control flow", "keys" : [] },

        {"id" : 9, "name" : "CONTAINS_NODE", "keys" : ["LOCAL_NAME", "INDEX"], "comment" : "Membership relation for a compound object"},
        {"id" : 28, "name" : "CONTAINS", "keys" : [], "comment" : "Shortcut over multiple AST edges"},
        {"id" : 41, "name": "CAPTURED_BY", "comment" : "Connection between a capture LOCAL and the corresponding CLOSURE_BINDING", "keys": []},

        // Edges to represent type relations

        {"id" : 22, "name" : "BINDS_TO", "keys": [], "comment" : "Type argument binding to a type parameter.", "keys" : [] },
        {"id" : 10, "name" : "REF", "keys" : [], "comment" : "Referencing to e.g. a LOCAL" },
        {"id" : 30, "name": "VTABLE", "comment" : "Indicates that a method is part of the vtable of a certain type declaration.", "keys": []}

    ],

    // Enums

    "evaluationStrategies" : [
        {"id" : 1, "name" : "BY_REFERENCE", "comment" : "A parameter or return of a function is passed by reference which means an address is used behind the scene."},
        {"id" : 2, "name" : "BY_SHARING", "comment" : "Only applicable to object parameter or return values. The pointer to the object is passed by value but the object itself is not copied and changes to it are thus propageted out of the method context."},
        {"id" : 3, "name" : "BY_VALUE", "comment" : "A parameter or return of a function passed by value which means a flat copy is used."}
    ],

    "dispatchTypes" : [
        {"id" : 1, "name" : "STATIC_DISPATCH", "comment": "For statically dispatched calls the call target is known before program execution."},
        {"id" : 2, "name" : "DYNAMIC_DISPATCH", "comment": "For dynamitcally dispatched calls the target is determined during runtime."}
    ],

    "languages" : [
        {"id" : 1, "name" : "JAVA", "comment" : ""},
        {"id" : 2, "name" : "JAVA_SCRIPT", "comment" : ""},
        {"id" : 3, "name" : "GOLANG", "comment" : ""},
        {"id" : 4, "name" : "CSHARP", "comment" : ""}
    ],

    "modifierTypes" : [
        {"id" : 1, "name" : "STATIC", "comment" : "The static modifier."},
        {"id" : 2, "name" : "PUBLIC", "comment" : "The public modifier."},
        {"id" : 3, "name" : "PROTECTED", "comment" : "The protected modifier."},
        {"id" : 4, "name" : "PRIVATE", "comment" : "The private modifier."},
        {"id" : 5, "name" : "ABSTRACT", "comment" : "The abstract modifier."},
        {"id" : 6, "name" : "NATIVE", "comment" : "The native modifier."},
        {"id" : 7, "name" : "CONSTRUCTOR", "comment" : "The constructor modifier."},
        {"id" : 8, "name" : "VIRTUAL", "comment" : "The virtual modifier."}
    ],

    // used in extensions
    "frameworks" : [],
    "operatorNames" : []

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy