You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/using-gitbase/examples.md
+72Lines changed: 72 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -126,3 +126,75 @@ CREATE INDEX files_lang_idx ON files USING pilosa (language(file_path, blob_cont
126
126
```sql
127
127
DROPINDEX files_lang_idx ON files;
128
128
```
129
+
130
+
# UAST UDFs Examples
131
+
132
+
First of all, you should check out the [bblfsh documentation](https://docs.sourced.tech/babelfish) to get yourself familiar with UAST concepts.
133
+
134
+
Also, you can take a look to all the UDFs and their signatures in the [functions section](/docs/using-gitbase/functions.md)
135
+
136
+
## Retrieving UASTs with the UDF `uast`
137
+
138
+
```sql
139
+
SELECT file_path, uast(blob_content, language(file_path)) FROM files;
140
+
```
141
+
142
+
This function allows you to directly filter the retrieved UAST by performing a XPATH query on it:
143
+
144
+
```sql
145
+
SELECT file_path, uast(blob_content, language(file_path), "//FuncLit") FROM files;
146
+
```
147
+
148
+
This UDF will give you `semantic` UASTs by default. To get some other type see the UDF [`uast_mode`](#retrieving-different-kinds-of-uasts-using-uast_mode).
149
+
150
+
## Retrieving different kinds of UASTs using `uast_mode`
0 commit comments