Skip to content

Commit 441ceeb

Browse files
committed
Refactor documentation and examples for clarity and consistency
- Updated vector search recommendations documentation to clarify key parameters and best practices. - Revised basic example documentation to use relative paths for database creation and improved query examples. - Enhanced index documentation to remove outdated checks and improve clarity on example usage. - Adjusted installation and getting started guides to standardize database path usage. - Updated queries guide to emphasize Gremlin over Cypher for graph queries, including migration guidance. - Improved graph documentation to recommend Gremlin for edge creation and querying. - Enhanced Java API coverage documentation to reflect improved coverage metrics. - Updated simple document store example to utilize the Document API for CRUD operations. - Improved vector benchmark script to run benchmarks in parallel with limited workers. - Updated copyright year in documentation files. - Adjusted core.py to standardize database path usage in examples. - Updated test README to clarify database creation paths for server mode.
1 parent af3cac7 commit 441ceeb

29 files changed

Lines changed: 646 additions & 1208 deletions

bindings/python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ We publish development versions (`X.Y.Z.devN`) for every push to main when `pom.
4646
import arcadedb_embedded as arcadedb
4747

4848
# Create database (context manager for automatic open and close)
49-
with arcadedb.create_database("/tmp/mydb") as db:
49+
with arcadedb.create_database("./mydb") as db:
5050
# Create schema
5151
db.command("sql", "CREATE DOCUMENT TYPE Person")
5252

bindings/python/docs/api-access-methods.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Direct JVM method calls via JPype - **recommended for most Python applications**
2020
import arcadedb_embedded as arcadedb
2121

2222
# Direct database access - NO server needed
23-
with arcadedb.create_database("/tmp/mydb") as db:
23+
with arcadedb.create_database("./mydb") as db:
2424
# Create schema (auto-transactional)
2525
db.schema.create_document_type("Person")
2626
db.schema.create_property("Person", "name", "STRING")
@@ -45,10 +45,11 @@ with arcadedb.create_database("/tmp/mydb") as db:
4545
import arcadedb_embedded as arcadedb
4646

4747
# Server manages databases (still Java API calls)
48-
server = arcadedb.create_server("/tmp/server_data", "password123")
48+
server = arcadedb.create_server("./server_data", "password123")
4949
server.start()
5050

5151
try:
52+
# "mydb" will be created at ./server_data/databases/mydb
5253
db = server.create_database("mydb")
5354

5455
# Schema operations are auto-transactional
@@ -89,7 +90,7 @@ import requests
8990
from requests.auth import HTTPBasicAuth
9091

9192
# Start server (using Java API)
92-
server = arcadedb.create_server("/tmp/server_data", "password123")
93+
server = arcadedb.create_server("./server_data", "password123")
9394
server.start()
9495

9596
try:
@@ -152,7 +153,7 @@ import requests
152153
from requests.auth import HTTPBasicAuth
153154

154155
# Start server
155-
server = arcadedb.create_server("/tmp/hybrid", "password123")
156+
server = arcadedb.create_server("./hybrid", "password123")
156157
server.start()
157158

158159
try:

bindings/python/docs/api/database.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Create a new database at the specified path.
2929
```python
3030
import arcadedb_embedded as arcadedb
3131

32-
db = arcadedb.create_database("/tmp/mydb")
32+
db = arcadedb.create_database("./mydb")
3333
try:
3434
# Schema operations are auto-transactional
3535
db.schema.create_document_type("Person")
@@ -41,7 +41,7 @@ finally:
4141
!!! tip "Use Context Manager"
4242
Prefer using `with` statement for automatic cleanup:
4343
```python
44-
with arcadedb.create_database("/tmp/mydb") as db:
44+
with arcadedb.create_database("./mydb") as db:
4545
# Database automatically closed on exit
4646
pass
4747
```
@@ -71,7 +71,7 @@ Open an existing database.
7171
**Example:**
7272

7373
```python
74-
with arcadedb.open_database("/tmp/mydb") as db:
74+
with arcadedb.open_database("./mydb") as db:
7575
result = db.query("sql", "SELECT FROM Person")
7676
print(f"Found {len(list(result))} records")
7777
```
@@ -97,10 +97,10 @@ Check if a database exists at the given path.
9797
**Example:**
9898

9999
```python
100-
if arcadedb.database_exists("/tmp/mydb"):
101-
db = arcadedb.open_database("/tmp/mydb")
100+
if arcadedb.database_exists("./mydb"):
101+
db = arcadedb.open_database("./mydb")
102102
else:
103-
db = arcadedb.create_database("/tmp/mydb")
103+
db = arcadedb.create_database("./mydb")
104104
```
105105

106106
---
@@ -490,7 +490,7 @@ Close the database connection.
490490
**Example:**
491491

492492
```python
493-
db = arcadedb.create_database("/tmp/mydb")
493+
db = arcadedb.create_database("./mydb")
494494
try:
495495
# Use database
496496
pass
@@ -562,7 +562,7 @@ DatabaseFactory(path: str)
562562
**Example:**
563563

564564
```python
565-
factory = arcadedb.DatabaseFactory("/tmp/mydb")
565+
factory = arcadedb.DatabaseFactory("./mydb")
566566
if factory.exists():
567567
db = factory.open()
568568
else:
@@ -607,7 +607,7 @@ All database objects support context managers:
607607

608608
```python
609609
# Database
610-
with arcadedb.create_database("/tmp/mydb") as db:
610+
with arcadedb.create_database("./mydb") as db:
611611
# Automatic cleanup
612612
pass
613613

@@ -681,7 +681,7 @@ All database operations can raise `ArcadeDBError`:
681681
from arcadedb_embedded import ArcadeDBError
682682

683683
try:
684-
with arcadedb.create_database("/tmp/mydb") as db:
684+
with arcadedb.create_database("./mydb") as db:
685685
# Schema operations are auto-transactional
686686
db.schema.create_document_type("User")
687687
db.schema.create_property("User", "email", "STRING")
@@ -706,11 +706,11 @@ except ArcadeDBError as e:
706706

707707
```python
708708
# ✅ Good - automatic cleanup
709-
with arcadedb.create_database("/tmp/mydb") as db:
709+
with arcadedb.create_database("./mydb") as db:
710710
pass
711711

712712
# ❌ Avoid - manual cleanup
713-
db = arcadedb.create_database("/tmp/mydb")
713+
db = arcadedb.create_database("./mydb")
714714
db.close()
715715
```
716716

@@ -740,10 +740,10 @@ db.query("sql", f"SELECT FROM Person WHERE name = '{user_input}'")
740740
### 4. Check Database Existence
741741

742742
```python
743-
if arcadedb.database_exists("/tmp/mydb"):
744-
db = arcadedb.open_database("/tmp/mydb")
743+
if arcadedb.database_exists("./mydb"):
744+
db = arcadedb.open_database("./mydb")
745745
else:
746-
db = arcadedb.create_database("/tmp/mydb")
746+
db = arcadedb.create_database("./mydb")
747747
```
748748

749749
---

bindings/python/docs/api/importer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ stats = arcadedb.import_csv(
7272
import arcadedb_embedded as arcadedb
7373

7474
with arcadedb.create_database("./restored_db") as db:
75-
db.command("sql", "IMPORT DATABASE file:///tmp/export.jsonl.tgz WITH commitEvery = 50000")
75+
db.command("sql", "IMPORT DATABASE file:///export.jsonl.tgz WITH commitEvery = 50000")
7676
```
7777

7878
For XML imports, use the `Importer` class directly (see below) with `format_type='xml'`.

bindings/python/docs/api/record-wrappers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ as the base class for `Vertex` and `Edge`.
2323
import arcadedb_embedded as arcadedb
2424
from arcadedb_embedded.graph import Document, Vertex, Edge
2525

26-
with arcadedb.create_database("/tmp/mydb") as db:
26+
with arcadedb.create_database("./mydb") as db:
2727
# Schema operations are auto-transactional
2828
db.schema.create_document_type("Note")
2929

bindings/python/docs/development/testing/best-practices.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ with arcadedb.create_database("./mydb") as db:
1717
# Also good for servers
1818
with arcadedb.create_server(root_path="./databases") as server:
1919
server.start()
20+
# "mydb" will be created at ./databases/mydb
2021
db = server.create_database("mydb")
2122
# ... work ...
2223
# Server automatically stopped
@@ -101,6 +102,7 @@ db2 = arcadedb.open_database("./mydb") # ❌ LockException!
101102
# Recommended: Start server first
102103
server = arcadedb.create_server(root_path="./databases")
103104
server.start()
105+
# "mydb" will be created at ./databases/mydb
104106
db = server.create_database("mydb")
105107

106108
# Use embedded access (fast!)
@@ -260,6 +262,7 @@ for i in range(1000):
260262
# Fast: No HTTP overhead, direct JVM call
261263
server = arcadedb.create_server(root_path="./databases")
262264
server.start()
265+
# "mydb" will be created at ./databases/mydb
263266
db = server.create_database("mydb")
264267

265268
# This is as fast as standalone embedded!

bindings/python/docs/development/testing/test-concurrency.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ server = arcadedb.create_server(root_path="./databases")
325325
server.start()
326326

327327
# Create database through server
328+
# "mydb" will be created at ./databases/mydb
328329
db = server.create_database("mydb")
329330

330331
# Now you have TWO ways to access:
@@ -406,6 +407,7 @@ db.close()
406407
# Process 1: Start server
407408
server = arcadedb.create_server(root_path="./databases")
408409
server.start()
410+
# "mydb" will be created at ./databases/mydb
409411
db = server.create_database("mydb")
410412

411413
# Process 2+: Use HTTP API

bindings/python/docs/development/testing/test-server-patterns.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,25 @@ server.stop()
128128

129129
**Why `close()` is required:**
130130

131-
```
132131
Your Python process:
133-
db = create_database("./temp_db") 🔒 Lock acquired
134-
# ... work ...
135-
db.close() 🔓 Lock released
136132

137-
server.start()
138-
server.get_database("mydb") 🔒 Server acquires lock ✅
133+
```python
134+
db = create_database("./temp_db") 🔒 Lock acquired
135+
# ... work ...
136+
db.close() 🔓 Lock released
137+
138+
server.start()
139+
server.get_database("mydb") 🔒 Server acquires lock ✅
140+
```
139141

140142
Without close():
141-
db = create_database("./temp_db") 🔒 Lock acquired
142-
# ... work ...
143-
# Forgot db.close()! 🔒 Still locked
143+
```python
144+
db = create_database("./temp_db") 🔒 Lock acquired
145+
# ... work ...
146+
# Forgot db.close()! 🔒 Still locked
144147

145-
server.start()
146-
server.get_database("mydb") ❌ LockException!
148+
server.start()
149+
server.get_database("mydb") ❌ LockException!
147150
```
148151

149152
!!! warning "Common Mistake"

bindings/python/docs/development/testing/test-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ server = arcadedb.create_server(
2828
server.start()
2929

3030
# Create database
31+
# "mydb" will be created at ./databases/mydb
3132
db = server.create_database("mydb")
3233

3334
# Use it

bindings/python/docs/examples/01_simple_document_store.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ This comprehensive example demonstrates ArcadeDB's document capabilities using a
88

99
The example creates a task management system showcasing:
1010

11-
- **Rich Data Types** - STRING, BOOLEAN, INTEGER, FLOAT, DECIMAL, DATE, DATETIME, LIST OF STRING, and Arrays
11+
- **Rich Data Types** - STRING, BOOLEAN, INTEGER, FLOAT, DECIMAL, DATE, DATETIME, LIST with element types, and Arrays
1212
- **NULL Handling** - INSERT with NULL, UPDATE to NULL, queries with IS NULL/IS NOT NULL
1313
- **SQL Operations** - Complete CRUD workflow with ArcadeDB SQL
1414
- **Built-in Functions** - date() for date literals, uuid() for unique IDs, sysdate() for dynamic timestamps
1515
- **Record Types** - Understanding Documents vs Vertices vs Edges
1616
- **Schema Flexibility** - Typed properties for performance with schema-optional flexibility
17-
- **Type Safety** - LIST OF STRING for validated array data
18-
19-
## Source Code
20-
21-
The complete example is available at: [`examples/01_simple_document_store.py`](https://github.com/humemai/arcadedb-embedded-python/blob/main/bindings/python/examples/01_simple_document_store.py)
17+
- **Type Safety** - Validated array data with element type specification
2218

2319
## Key Learning Points
2420

@@ -29,15 +25,15 @@ ArcadeDB provides comprehensive data type support with NULL handling:
2925
```python
3026
from datetime import date
3127
import uuid
32-
import arcadedb
28+
import arcadedb_embedded as arcadedb
3329

3430
with arcadedb.create_database("./task_db") as db:
3531
# Schema operations are auto-transactional (no wrapper needed)
3632
db.schema.create_document_type("Task")
3733
db.schema.create_property("Task", "title", "STRING")
3834
db.schema.create_property("Task", "priority", "STRING")
3935
db.schema.create_property("Task", "completed", "BOOLEAN")
40-
db.schema.create_property("Task", "tags", "LIST OF STRING") # Type-safe arrays
36+
db.schema.create_property("Task", "tags", "LIST", of_type="STRING")
4137
db.schema.create_property("Task", "created_date", "DATE")
4238
db.schema.create_property("Task", "due_datetime", "DATETIME")
4339
db.schema.create_property("Task", "estimated_hours", "FLOAT")
@@ -68,7 +64,7 @@ Learn about built-in functions and NULL handling:
6864
```python
6965
from datetime import datetime
7066
import uuid
71-
import arcadedb
67+
import arcadedb_embedded as arcadedb
7268

7369
with arcadedb.open_database("./task_db") as db:
7470
# Insert with Python-native types (UUID, datetime handled by converter)
@@ -82,8 +78,15 @@ with arcadedb.open_database("./task_db") as db:
8278
task.save()
8379

8480
# Query for NULL values (reads don't need transaction)
85-
result = db.query("sql", "SELECT FROM Task WHERE due_datetime IS NULL")
86-
result = db.query("sql", "SELECT FROM Task WHERE cost IS NULL")
81+
print("Tasks with NULL due_datetime:")
82+
result = db.query("sql", "SELECT title, due_datetime, cost FROM Task WHERE due_datetime IS NULL")
83+
for record in result:
84+
print(f" Title: {record.get('title')}, Due: {record.get('due_datetime')}, Cost: {record.get('cost')}")
85+
86+
print("\nTasks with NULL cost:")
87+
result = db.query("sql", "SELECT title, due_datetime, cost FROM Task WHERE cost IS NULL")
88+
for record in result:
89+
print(f" Title: {record.get('title')}, Due: {record.get('due_datetime')}, Cost: {record.get('cost')}")
8790

8891
# UPDATE via API (fetch + mutate in transaction)
8992
with db.transaction():
@@ -107,7 +110,7 @@ Understanding when to use different record types:
107110
The example demonstrates:
108111

109112
- **NULL Values** - Optional fields with IS NULL/IS NOT NULL queries
110-
- **Type-Safe Arrays** - LIST OF STRING for validated collections
113+
- **Type-Safe Arrays** - LIST with of_type parameter for validated collections
111114
- **DECIMAL Handling** - Java BigDecimal conversion via float(str(value))
112115
- **DATETIME Literals** - String literals automatically parsed to DATETIME type
113116
- **Schema-Optional Flexibility** - Define properties for performance, add ad-hoc fields when needed
@@ -134,7 +137,7 @@ After running, examine the created files:
134137

135138
```text
136139
my_test_databases/task_db/
137-
├── configuration.json # Database configuration
140+
├── configuration.json # Database configuration
138141
├── schema.json # Type definitions with LIST OF STRING
139142
├── Task_*.bucket # Data storage files with tasks
140143
├── dictionary.*.dict # String compression dictionary
@@ -154,8 +157,10 @@ After mastering this example:
154157
**Q: How does ArcadeDB handle NULL values?**
155158
A: All ArcadeDB types support NULL by default. You can INSERT NULL, UPDATE to NULL, and query with IS NULL/IS NOT NULL operators.
156159

157-
**Q: What's the difference between LIST and LIST OF STRING?**
158-
A: LIST is a generic untyped list. LIST OF STRING provides type validation ensuring all elements are strings, giving better performance and data integrity.
160+
**Q: How do I create a LIST with STRING elements?**
161+
A: In Python API: `db.schema.create_property("Task", "tags", "LIST", of_type="STRING")`.
162+
In SQL: `CREATE PROPERTY Task.tags LIST OF STRING`. Both create a type-safe list of
163+
strings.
159164

160165
**Q: Why use typed properties?**
161166
A: They provide better performance, validation, and enable advanced features like indexes. But ArcadeDB is schema-optional - you can still add properties dynamically.

0 commit comments

Comments
 (0)