Skip to content

Graph and Full Text

xuji755 edited this page Oct 9, 2026 · 1 revision

Graph and full-text search

bicdb stores graph entities, adjacency records, property indexes and full-text changes in the same transactional engine as relational data.

Create and query a graph

CREATE GRAPH knowledge;

CYPHER knowledge '
  CREATE (a:Entity {db_type:"mariadb",name:"high IO"}),
         (b:Solution {db_type:"mariadb",name:"inspect slow SQL"}),
         (a)-[:HAS_SOLUTION {weight:10}]->(b)
';

CYPHER knowledge '
  MATCH (n:Entity)-[r:HAS_SOLUTION]->(s:Solution)
  WHERE n.db_type="mariadb"
  RETURN n.name,s.name,r.weight
';

The implemented Cypher subset covers MATCH, OPTIONAL MATCH, WHERE, WITH, UNWIND, RETURN, aggregation, bounded variable paths, shortestPath, CALL, EXISTS, UNION, and the documented write clauses.

Property indexes

CREATE GRAPH INDEX domain_name ON knowledge
  NODES LABEL "Entity" (db_type,name);

CREATE UNIQUE GRAPH INDEX solution_name ON knowledge
  NODES LABEL "Solution" (name);

PROFILE CYPHER knowledge '
  MATCH (n:Entity)
  WHERE n.db_type=$domain AND n.name=$name
  RETURN n
' PARAMETERS '{"domain":"mariadb","name":"high IO"}';

Indexes support scalar and composite keys, JSON object paths, ranges and uniqueness.

Full-text indexes and deferred maintenance

CREATE FULLTEXT GRAPH INDEX answers ON knowledge
  NODES LABEL ("Entity", "Solution")
  (name,config.question)
  OPTIONS '{"update":"batch","interval_ms":5000,"batch_rows":256}';

SEARCH FULLTEXT GRAPH INDEX answers ON knowledge FOR 'IO diagnosis'
  OPTIONS '{"db_type":"mariadb","consistency":"eventual","limit":20}';

ALTER FULLTEXT GRAPH INDEX answers ON knowledge SYNC;
ALTER FULLTEXT GRAPH INDEX answers ON knowledge WAIT
  OPTIONS '{"timeout_ms":30000}';

Batch mode records source changes in the committing transaction and performs tokenization and inverted-index maintenance between foreground requests. eventual reads the published generation and rejects stale hits; strict includes the current source view and may perform a bounded source scan. Indexes can also be paused, resumed, synchronized manually or maintained on a timer.

Cypher procedures include db.index.fulltext.queryNodes, queryRelationships and bicdb.searchNodes for ranked multi-index fusion.

SQL integration

SELECT g.name,o.owner
FROM GRAPH_TABLE(
  knowledge,
  'MATCH (n:Entity) RETURN n.name'
  COLUMNS (name VARCHAR2(128))
) g
LEFT JOIN owners o ON g.name=o.entity_name;

GRAPH_TABLE output participates in relational filters, joins, aggregation, set operations and INSERT … SELECT. A transient GRAPH_ELEMENT value can identify a node or relationship within the statement but cannot be persisted as a normal column.

See the repository's complete graph guide for configuration and exact limits.

Clone this wiki locally