### Install Dependencies and Build Source: https://github.com/codefuse-ai/codefuse-query/blob/main/language/javascript/extractor/README.md Installs project dependencies using Yarn and then builds the package. This generates the executable file. ```bash yarn npm run pkg ``` -------------------------------- ### Hello World Query Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.md A simple 'hello world' example using GödelScript query syntax. The output column name is specified using 'as'. ```rust query hello_world from info in "hello world" select info as greeting ``` -------------------------------- ### Install Extension via Command Line Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/5_toolchain.md Manually install the CodeFuse Query extension using a VSIX file directly from the terminal. ```bash code --install-extension [扩展vsix文件路径] ``` -------------------------------- ### Install Extension via Command Line Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/5_toolchain.en.md Use this command to manually install a VSIX plugin package from your terminal. ```bash code --install-extension [extension vsix file path] ``` -------------------------------- ### Install Yarn Source: https://github.com/codefuse-ai/codefuse-query/blob/main/language/javascript/extractor/README.md Installs Yarn globally using npm. This is a prerequisite for managing project dependencies. ```bash npm install --global yarn ``` -------------------------------- ### Full GödelScript Program Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.md An example showcasing the complete structure of a GödelScript program, including module imports, schema and database declarations, schema method implementation, and query definition. ```rust // script // 包引入/符号引入 use coref::java::* // 引入所有符号 use coref::java::{JavaDB, Class} // 选择性引入符号 // 函数声明 fn default_db() -> JavaDB { return JavaDB::load("example.db") } // schema 声明 schema File { @primary id: int } // database 声明 database NewDB { file: *File } // impl impl File { @data_constraint fn __all__() -> *File { yield File {id: 1} yield File {id: 2} } } // query query get_all_anno from Annotation anno in Annotation(default_db()) select anno.id as id ``` -------------------------------- ### Java HelloWorld Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/3_install_and_run.en.md A basic Java class demonstrating string manipulation and method calls. ```java public class HelloWorld { public static void main(String[] args) { HelloWorld tmp = new HelloWorld(); String hello = tmp.getHello(); String world = tmp.getWorld(); System.out.println(hello + " " + world); } public String getHello() { return "Hello"; } public String getWorld() { return "World"; } } ``` -------------------------------- ### Spread Syntax Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/schemas.md Demonstrates the spread syntax for initializing a child schema instance by expanding a parent schema instance. ```rust yield Lee { ..parent, for_example: 114 } // this is equivalent to // yield Lee { id: parent.id, name: parent.name, phone: parent.phone, for_example: 114 } ``` -------------------------------- ### Path Mapping Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.md Demonstrates valid and conflicting path mappings in the GödelScript package manager. ```rust Library |-- coref.java.gdl |-- coref.xml.gdl +-- coref |-- go.gdl +-- a +-- b.gdl => coref::java coref::xml coref::go coref::a::b ``` ```rust Library |-- coref | |-- java.gdl | +-- python.gdl +-- coref.python.gdl => coref::java coref::python -- \ > 出现冲突 coref::python -- / ``` ```rust Library |-- 0123.gdl |-- my-godel-lib | +-- js.gdl +-- lib-file.123.gdl => 0123 ^ 第一个字符为数字 my-godel-lib::js ^ ^ 使用了 `-` 字符 lib-file::123 ^ ^ 使用了一个字符为数字,并且路径中包含 `-` ``` -------------------------------- ### GödelScript Set Type Examples Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/type.md Illustrates specific examples of set type definitions for int, string, and Annotation. ```rust *int // int set *string // string set *Annotation // schema Annotation set ``` -------------------------------- ### Example Database Declaration Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Maps the 'annotation' table in the database to the 'Annotation' schema. ```rust database JavaDB { // Reads data from the db's annotation table and stores it in Annotation annotation : *Annotation } ``` -------------------------------- ### Load Database Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Demonstrates how to load a database using the static `load` method. The filename is provided, while the database path is passed as a command-line argument. ```rust fn loadDatabaseExample() -> bool { // The string passed to load is the db's filename, not the path // The db's path will be passed as a command-line argument when executing godel let (db: JavaDB = JavaDB::load("...")) { ... } } ``` -------------------------------- ### Get Basic Information for All Go Files Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.md This snippet retrieves fundamental details for Go files, including name, function count, total lines, code lines, comment lines, and checksums (MD5, SHA256). Use this to get a high-level overview of files in a Go project. ```GödelScript // script use coref::go::* fn default_db() -> GoDB { return GoDB::load("coref_go_src.db") } /** * @param name file name * @param funcCount function/method quantity * @param totallines total lines of file * @param codelines code line of file * @param commentlines comment line of fine * @param md5 md5 of this file * @param sha256 sha256 of this file */ fn out( name: string, funcCount: int, totallines: int, codelines: int, commentlines: int, md5: string, sha256: string) -> bool { for(f in File(default_db())) { if (name = f.getName() && funcCount = f.getFunctionCount() && md5 = f.getMd5Sum() && sha256 = f.getSha256Sum() && totallines = f.getLineInfo().getNumberOfTotalLines() && codelines = f.getLineInfo().getNumberOfCodeLines() && commentlines = f.getLineInfo().getNumberOfCommentLines()) { return true } } } fn main() { output(out()) } ``` -------------------------------- ### GödelScript Hello World Query Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md A simple 'hello world' example using GödelScript's query syntax. Demonstrates selecting a variable directly. ```rust query hello_world from info in "hello world" select info as greeting ``` -------------------------------- ### Equivalent Function for Query Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.md Shows the equivalent function definition for the 'hello_world' query example, demonstrating how queries map to functions and output statements. ```rust fn hello_world(greeting: string) -> bool { let (info = "hello world") { if (greeting = info) { return true } } } fn main() { output(hello_world()) } ``` -------------------------------- ### GödelScript Program Components Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/program.md This example demonstrates a comprehensive GödelScript program including package import, function declaration, enum, schema, database declarations, schema method implementation, and query declaration. ```rust // package import use coref::java::{Annotation, JavaDB} // function declaration fn default_db() -> JavaDB { return JavaDB::load("example.db") } // enum declaration Enum status { killed, running, suspend } // schema declaration Schema File { @primary id: int } // database declaration database NewDB { file: *File } impl File { pub fn __all__() -> *File { yield File {id: 1} yield File {id: 2} } pub fn getId(self) -> int { return self.id } } // query declaration query get_all_anno from anno in Annotation(default_db()) select anno.id as id ``` -------------------------------- ### Installation and Build Instructions for Go COREF Extractor Source: https://github.com/codefuse-ai/codefuse-query/blob/main/language/go/extractor/README.md Clone the repository, navigate to the Go extractor directory, and build the project. This prepares the executable for direct use. ```shell # Clone the repository git clone https://github.com/codefuse-ai/CodeFuse-Query.git # Navigate to the Go extractor project directory cd language/go/extractor # Build the project go build -o coref-go-extractor src/cli/extractor_cli.go src/cli/helper.go ``` -------------------------------- ### Detailed Example with Assignment Semantics in GödelScript Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Shows a detailed example constructing data for output, highlighting GödelScript's special '=' operator with dual assignment and equality semantics. Boolean values use 'true' and 'false' keywords. ```rust fn example(a: int, b: string) -> bool { // The = symbol serves both assignment and comparison purposes, depending on whether the left-hand value has been "assigned" // Here, the = symbols for a and b are used with assignment semantics if (a = 1 && b = "1") { // GödelScript uses the keywords true and false to represent boolean values return true } if (a = 2 && b = "2") { return true } } fn main() { output(example()) } ``` ```json [ {"a": 1, "b": "1"}, {"a": 2, "b": "2"} ] ``` -------------------------------- ### Initialize Schema from Database Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/schemas.md Fetches the universal set of 'Student' schemas from a database connection. Includes an example function to filter students by name. ```rust database DB { students: *Student } impl Student { pub fn __all__(db: DB) -> *Student { return db.students } } fn getStudents() -> *Student { let (db = DB::load("example.db")) { for (student in Student(db)) { if (student.name.contains("von")) { yield student } } } } ``` -------------------------------- ### Path Mapping Example: Valid Paths Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Demonstrates a valid path mapping scenario where file paths are correctly translated into GödelScript package paths. ```rust Library |-- coref.java.gdl |-- coref.xml.gdl +-- coref |-- go.gdl +-- a +-- b.gdl => coref::java coref::xml coref::go coref::a::b ``` -------------------------------- ### Use an Enum Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/enums.md Demonstrates how to return enum values from a function. The function 'example' returns a value of type 'Status'. ```rust fn example() -> Status { Status::exited Status::running Status::suspend } ``` -------------------------------- ### GödelScript Example Tokens and Literals Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/syntax.md Illustrates the usage of identifiers, number literals, and string literals in GödelScript. ```rust this_is_an_identifier 12345 "string literal" ``` -------------------------------- ### Access Data Table Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Shows how to access data within a loaded database, specifically the 'annotation' table, using direct field access. ```rust fn getAnnotation() -> Annotation { // The string passed to load is the db's filename, not the path // The db's path will be passed as a command-line argument when executing godel let (db: JavaDB = JavaDB::load("...")) { // Directly use db.field to access the table data for (anno: Annotation in db.annotation) { ... } } } ``` -------------------------------- ### Path Mapping Example: Path Conflict Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Illustrates a path conflict scenario where multiple files map to the same package path, resulting in an error. ```rust Library |-- coref | |-- java.gdl | +-- python.gdl +-- coref.python.gdl => coref::java coref::python -- \ > Conflict coref::python -- / ``` -------------------------------- ### Basic GödelScript Program Structure Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md An example demonstrating the fundamental components of a GödelScript program, including imports, schema, database declarations, implementations, and queries. ```rust // script // Package import/symbol import use coref::java::* // Import all symbols use coref::java::{JavaDB, Class} // Selective symbol import // Function declaration fn default_db() -> JavaDB { return JavaDB::load("example.db") } // Schema declaration schema File { @primary id: int } // Database declaration database NewDB { file: *File } // Impl impl File { @data_constraint fn __all__() -> *File { yield File {id: 1} yield File {id: 2} } } // Query query get_all_anno from Annotation anno in Annotation(default_db()) select anno.id as id ``` -------------------------------- ### Main Function for Output Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.md An example of a `main` function in GödelScript, which is used to output query results. The `main` function has no return value and is optional. ```rust fn main() { output(query_1()) output(query_2()) } ``` -------------------------------- ### Example GDL Script Output JSON Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/3_install_and_run.en.md The expected JSON output after running a GDL script against the created database. This format lists the names of identified methods. ```json [{"name": "getHello"}, {"name": "getWorld"}, {"name": "main"}] ``` -------------------------------- ### GödelScript Query Syntax Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Illustrates the basic structure of a GödelScript query, including 'from', 'where', and 'select' clauses. Variable types are inferred, and 'in' is used in the select list. ```rust query name from variable in initial value, variable in initial value, variable in initial value where condition select value as output column name value as output column name, value as output column name, value as output column name ``` -------------------------------- ### Full Path Symbol Usage: Schema Static Method Calls Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Provides examples of using fully qualified symbol paths in static method calls within schemas. ```rust for(loc in coref::java::Location(coref::java::JavaDB::load("..."))) { ... } stmt.to() stmt.is() ``` -------------------------------- ### Path Mapping Example: Invalid Characters Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Shows examples of invalid path components, such as paths starting with digits or containing hyphens, and how they are handled. ```rust Library |-- 0123.gdl |-- my-godel-lib | +-- js.gdl +-- lib-file.123.gdl => 0123 ^ The first character is a digit my-godel-lib::js ^ ^ Uses the `-` character lib-file::123 ^ ^ First character after `.` is a digit, and the path contains `-` ``` -------------------------------- ### Gödel Script to Get Java Method Names Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/3_install_and_run.en.md An example Gödel script that loads a Java database and iterates through all methods to retrieve their names. This script is used to obtain specific code data from the extracted database. ```go // script use coref::java::* // Define the global Java database fn default_db() -> JavaDB { return JavaDB::load("coref_java_src.db") } // Iterate over all methods, get the method name, output limit fn getFunctionName(name: string) -> bool { let (db = default_db()) { for (method in Method(db)) { if (name = method.getName()) { return true } } } } fn main() { output(getFunctionName()) } ``` -------------------------------- ### GödelScript Condition Statement Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/functions.md Provides an example of a condition statement ('if'). GödelScript's condition statements do not support 'else' to prevent 'ungrounded error' in Soufflé. ```rust if (xxxxx) { ... } ``` -------------------------------- ### Load Database using Path Call Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/functions.md Illustrates loading a database from a file using the `DB::load` method and iterating over schema instances within it. ```rust fn example() -> *int { let (db = DB::load("example_src.db")) { // ^^^^^^^^^^^^^^^^^^^^^^ for(stu in Student(db)) { yield stu.id } } } ``` -------------------------------- ### Define Schema and Initializer List Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/functions.md Demonstrates how to define a schema with fields and implement a function that initializes a schema instance using an initializer list. ```rust schema Student { @primary id: int, name: string } impl Student { pub fn __all__(db: DB) -> *Student { return db.students } } fn example() -> Student { return Student {id: 0, name: "xxx"} } ``` -------------------------------- ### Initialize GödelScript Database Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/databases.md Load a database using the `School::load` method, passing a string literal for the database file name. This method returns an instance of the database schema. ```rust fn default_db() -> School { return School::load("example_db_school.db") // must use string literal } ``` -------------------------------- ### Parent Field Inheritance Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Subclasses automatically inherit all fields from their parent classes. ```rust schema File { @primary id: int, name: string } schema MyFile extends File {} ``` -------------------------------- ### GödelScript Expression Structure Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/syntax.md Defines the basic structure of expressions in GödelScript, starting with 'or_expr'. ```ebnf expression = or_expr; ``` -------------------------------- ### GödelScript Inline Annotation Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/syntax.md Demonstrates how to use an inline annotation with a function declaration in GödelScript. ```rust @inline fn get(a: Method) -> bool { ... } ``` -------------------------------- ### Method Override Example Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Subclass methods with the same name as parent methods override them. Parameter and return types can differ. ```rust schema File { @primary id: int, name: string } impl File { fn staticMethod() -> string {return "File"} } schema MyFile extends File {} impl MyFile { fn staticMethod() -> string {return "MyFile"} } ``` -------------------------------- ### Using Fully Qualified Paths Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.md Demonstrates using fully qualified paths for various GödelScript constructs, including schema inheritance, function parameters/return types, database declarations, query list types, and schema static method calls. ```rust schema JavaLocation extends coref::java::Location {} ``` ```rust fn return_java_file(f: coref::java::File) -> coref::java::File { ... } ``` ```rust database MyDB { java_file: coref::java::File, xml_file: coref::xml::File, java_loc: coref::java::Location, xml_loc: coref::xml::Location } ``` ```rust query example from coref::java::Location loc in coref::java::Location(coref::java::JavaDB::load("...")) where ... select ... ``` ```rust for(loc in coref::java::Location(coref::java::JavaDB::load("..."))) { ... } stmt.to() stmt.is() ``` -------------------------------- ### Displaying Help for Go COREF Extractor Source: https://github.com/codefuse-ai/codefuse-query/blob/main/language/go/extractor/README.md Access the help information for the Go COREF extractor executable. This command displays available options and usage details. ```shell ./coref-go-extractor -h ``` -------------------------------- ### Get Entry Key Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.md Retrieves the 'key' attribute value from an EntryXmlElement. This function is useful for identifying entries by their key. ```rust // get key fn getKey(e: EntryXmlElement) -> string { for (attr in e.getAttribute()) { if (attr.getName() = "key") { return attr.getValue() } } } ``` -------------------------------- ### Define a GödelScript Query Name Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/queries.md A query must start with the keyword 'query' followed by a unique query name. ```rust query this_is_example_query ``` -------------------------------- ### Full Path Symbol Usage: Function Parameters and Return Values Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Demonstrates using fully qualified symbol paths for function parameters and return types. ```rust fn return_java_file(f: coref::java::File) -> coref::java::File { ... } ``` -------------------------------- ### Access Table from Database Instance Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/functions.md Illustrates how to access a table (e.g., 'students') from a database instance within an implementation block. ```rust impl Student { @data_constraint fn __all__(db: DB) -> *Student { return db.students // ^^^^^^^^^ } } ``` -------------------------------- ### Full Path Symbol Usage: Schema Inheritance Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md Example of using a fully qualified symbol path within schema inheritance. ```rust schema JavaLocation extends coref::java::Location {} ``` -------------------------------- ### Get Cyclomatic Complexity of Functions Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/4_godelscript_language.en.md This snippet calculates the cyclomatic complexity of functions within a Python codebase. It requires a pre-loaded PythonDB. ```rust // script use coref::python::* fn default_db() -> PythonDB { return PythonDB::load("coref_python_src.db") } /** * Get cyclomatic complexity of functions * * @param name function name * @param value cyclomatic complexity of function * @param path path of file including this function * @param sline function start line * @param eline function end line */ fn getCyclomaticComplexity( name: string, value: int, path: string, sline: int, eline: int) -> bool { // get metric function for (c in MetricFunction(default_db())) { if (path = c.getLocation().getFile().getRelativePath() && name = c.getQualifiedName() && value = c.getCyclomaticComplexity() && sline = c.getLocation().getStartLineNumber() && eline = c.getLocation().getEndLineNumber()) { return true } } } fn main() { output(getCyclomaticComplexity()) } ``` -------------------------------- ### Create Sparrow Database Source: https://github.com/codefuse-ai/codefuse-query/blob/main/tutorial/notebook/javascript_analysis.ipynb Creates a structured database from a source code repository for analysis. Specify the source root, programming language, and output path for the database file. Overwrites existing files if specified. ```python !sparrow database create --source-root axios --data-language-type javascript --output ./db/axios --overwrite > /dev/null ``` -------------------------------- ### JavaScript Rule: Get Influenced TrAPI Source: https://github.com/codefuse-ai/codefuse-query/blob/main/example/icse25/motivation example.md Determines which TrAPIs are influenced by changes, by correlating changed TrAPIs with application facade configurations. ```javascript getInfluencedTrAPI(appName, proxyFacadeName, facadeQualifiedName, trMethodName) :- getChangedTrAPI(facadeQualifiedName, trMethodName), getAppFacade(appName, proxyFacadeName, facadeQualifiedName). ``` -------------------------------- ### Project and Library Configuration Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/godel-backend/extension/CMakeLists.txt Defines the project name, sets the C++ standard, includes necessary directories, adds compile definitions, and specifies the shared library target. ```cmake project(souffle_ext) set(CMAKE_CXX_STANDARD 17) include_directories(../souffle/src/include) add_compile_definitions(RAM_DOMAIN_SIZE=64) add_library(souffle_ext SHARED library.cpp) ``` -------------------------------- ### Hasher Algorithm Type Definitions Source: https://github.com/codefuse-ai/codefuse-query/blob/main/language/cfamily/extractor/ThirdParty/digestpp/README.md Examples of defining specific hash algorithms using the Hasher class template with different providers and mixins. ```C++ typedef hasher sha3; typedef hasher blake; ``` -------------------------------- ### TypeScript Rule: Get Influenced TrAPICall Source: https://github.com/codefuse-ai/codefuse-query/blob/main/example/icse25/motivation example.md Identifies influenced TrAPI calls in TypeScript by linking influenced TrAPIs with call expressions and references. ```typescript getInfluencedTrAPICall(appName, proxyFacadeName, callExprId) :- getInfluencedTrAPI(appName, proxyFacadeName, facadeQualifiedName, trMethodName), callExpr(callExprId, mid, _, callSiteId), reference(callSiteId, defId), api(defId, proxyFacadeName, _, _). ``` -------------------------------- ### Configure Souffle Build Options Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/CMakeLists.txt Configures build options for Souffle, such as 64-bit domain, disabling curses, and disabling testing. ```cmake set(SOUFFLE_DOMAIN_64BIT ON) set(SOUFFLE_USE_CURSES OFF) set(SOUFFLE_ENABLE_TESTING OFF) ``` -------------------------------- ### Build Java Extractor with Maven Source: https://github.com/codefuse-ai/codefuse-query/blob/main/language/java/extractor/README.md Compile and package the Java extractor using Maven. This command cleans previous builds and installs the project artifacts. ```bash mvn clean install ``` -------------------------------- ### Run the Properties Extractor Source: https://github.com/codefuse-ai/codefuse-query/blob/main/language/properties/extractor/README.md Executes the properties extractor JAR file. Replace ${YOUR_REPO} with the path to your repository and ./db with the desired output directory. ```shell java -jar target/properties-extractor-1.0-SNAPSHOT-jar-with-dependencies.jar ${YOUR_REPO} ./db ``` -------------------------------- ### CodeFuse CLI Commands for Java Source: https://github.com/codefuse-ai/codefuse-query/blob/main/doc/3_install_and_run.en.md Commands to create a CodeFuse database from Java source code and run a query. Ensure the Java file is in the specified directory and the GDL script is in the current directory. ```bash sparrow database create -s -lang java -o ./db/ sparrow query run -d ./db/ -gdl example.gdl -o ./ ``` -------------------------------- ### Primary Key Comparison Methods Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/schemas.md Shows the usage of 'key_eq' and 'key_neq' methods for comparing primary keys of schemas with an 'int' type primary key. ```rust method.key_eq(function) method.key_neq(function) ``` -------------------------------- ### Call Method on Basic or Schema Instance Source: https://github.com/codefuse-ai/codefuse-query/blob/main/godel-script/docs/language-reference/functions.md Demonstrates calling methods on instances of basic types (like integers) or schema instances, using the '.' operator. ```rust fn example() -> *int { yield 1.add(2) // ^^^^^^^^^ yield Student {id: 0, name: "xxx"}.getId() // ^^^^^^^^^ } ``` -------------------------------- ### Clone Druid Repository and Checkout Version Source: https://github.com/codefuse-ai/codefuse-query/blob/main/language/sql/extractor/README.md Clone the Druid repository and switch to the specific release version required for analysis. ```bash # Clone the Druid repository and switch to the corresponding release version git clone https://github.com/alibaba/druid # refers to the version specified in pom.xml git checkout tags/ cd druid ```