Coder Social home page Coder Social logo

Comments (2)

mpollmeier avatar mpollmeier commented on August 11, 2024

The public api is designed so you'll do the right thing by default. In other words, you'll get NodeRefs, because a Call is a NodeRef:

joern> val call = cpg.call.head
call: Call = Call(
  id -> 350254634311902973L,
  argumentIndex -> 7,
  argumentName -> None,
  code -> "pat == null",
  columnNumber -> None,
  dispatchType -> "STATIC_DISPATCH",
  dynamicTypeHintFullName -> ArraySeq(),
  lineNumber -> None,
  methodFullName -> "<operator>.equals",
  name -> "<operator>.equals",
  order -> 7,
  signature -> "",
  typeFullName -> "<empty>"
)

joern> call.isInstanceOf[NodeRef[_]]
res6: Boolean = true

joern> call.isInstanceOf[NodeDb]
res7: Boolean = false

You can pass them around and store them in your maps/lists/whereever, they are just a thin reference to the actual data. What you should not do is hold onto the NodeDb instance, which you can get via call.get. On low memory, overflowdb drops the on-heap instance to clear some space, and will use the id from the NodeRef instance to load it back from disk if required.

The domain specific nodes and edges are generated based on the schema. To see the sources, simply run sbt compile and have a look in schema/target/scala-3.1.0/src_managed/main/overflowdb-codegen/io/shiftleft/codepropertygraph/generated

from codepropertygraph.

mal-tee avatar mal-tee commented on August 11, 2024

That makes sense, thank you very much!

from codepropertygraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.