diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/OverlayNode.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/OverlayNode.kt index 24b28fda4d..cd6a91b45a 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/OverlayNode.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/OverlayNode.kt @@ -29,4 +29,4 @@ package de.fraunhofer.aisec.cpg.graph * Represents an extra node added to the CPG. These nodes can live next to the CPG, typically having * shared edges to extend the original CPG graph. */ -interface OverlayNode +abstract class OverlayNode : Node() diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/Concept.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/Concept.kt index bbeac0ebd8..d676a3c837 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/Concept.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/Concept.kt @@ -28,8 +28,14 @@ package de.fraunhofer.aisec.cpg.graph.concepts import de.fraunhofer.aisec.cpg.graph.Node import de.fraunhofer.aisec.cpg.graph.OverlayNode -/** A node extending the CPG and storing the corresponding/responsible [cpgNode]. */ -abstract class Concept : Node(), OverlayNode { +/** + * Represents a new concept added to the CPG. This is intended for modelling "concepts" like + * logging, files, databases. The relevant operations on this concept are modeled as [Operation]s + * and stored in [ops]. + */ +abstract class Concept() : OverlayNode() { /** All concept nodes are connected to an original cpg [Node] by this. */ abstract val cpgNode: Node + /** All [Operation]s belonging to this concept. */ + abstract val ops: Set } diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/ConceptNode.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/Operation.kt similarity index 69% rename from cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/ConceptNode.kt rename to cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/Operation.kt index b89e552ce9..9fa747e3dd 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/ConceptNode.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/Operation.kt @@ -25,11 +25,16 @@ */ package de.fraunhofer.aisec.cpg.graph.concepts +import de.fraunhofer.aisec.cpg.graph.Node +import de.fraunhofer.aisec.cpg.graph.OverlayNode + /** - * Represents a new concept added to the CPG. This is intended for modelling "concepts" like - * logging, files, databases. The relevant operations on this concept are modeled as - * [OperationNode]s and stored in [ops]. + * Represents an operation executed on/with a [Concept] (stored in [concept]). This is typically a + * `write` on a file or log object or an `execute` on a database. */ -abstract class ConceptNode() : Concept() { - abstract val ops: Set +abstract class Operation : OverlayNode() { + /** All concept nodes are connected to an original cpg [Node] by this. */ + abstract val cpgNode: Node + /** The [Concept] this operation belongs to. */ + abstract val concept: Concept } diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/OperationNode.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/OperationNode.kt deleted file mode 100644 index 1c9c61c247..0000000000 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/concepts/OperationNode.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2024, Fraunhofer AISEC. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $$$$$$\ $$$$$$$\ $$$$$$\ - * $$ __$$\ $$ __$$\ $$ __$$\ - * $$ / \__|$$ | $$ |$$ / \__| - * $$ | $$$$$$$ |$$ |$$$$\ - * $$ | $$ ____/ $$ |\_$$ | - * $$ | $$\ $$ | $$ | $$ | - * \$$$$$ |$$ | \$$$$$ | - * \______/ \__| \______/ - * - */ -package de.fraunhofer.aisec.cpg.graph.concepts - -/** - * Represents an operation executed on/with a [ConceptNode] (stored in [concept]). This is typically - * a `write` on a file or log object or an `execute` on a database. - */ -abstract class OperationNode : Concept() { - abstract val concept: ConceptNode -}