Skip to content

Commit f9728cd

Browse files
committed
docs(gfql): clarify schema accessor scope
1 parent 53bece7 commit f9728cd

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

docs/source/api/plotter.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ declared Arrow types after normal Arrow conversion. The default
2929

3030
Use the experimental read-only ``g.schema`` accessor to inspect the bound
3131
``GraphSchema`` object, or ``g.has_schema()`` when only a predicate is needed.
32+
This reports only the local declaration attached through ``bind(schema=...)``:
33+
it does not infer a schema from data, fetch a remote dataset schema, or serialize
34+
the schema into ``gfql_remote()`` requests.
3235

3336
.. toctree::
3437
:maxdepth: 3

docs/source/gfql/schema.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ Schema Objects
102102
Read back the experimental ``GraphSchema`` bound with ``bind(schema=...)``.
103103
``g.schema`` returns the bound object or ``None``; ``g.has_schema()`` returns
104104
a matching boolean. Use ``bind(schema=...)`` to attach schemas, not assignment.
105+
This is local declaration introspection only. It does not infer schemas from
106+
data, fetch or hydrate remote dataset schemas, or serialize schemas into
107+
``gfql_remote()`` requests in this release.
108+
109+
Per-type declarations such as Cat, Dog, and Car are represented by
110+
``GraphSchema.node_types``. The stable public type identity is
111+
``NodeType.name``; ``NodeType.labels`` are the GFQL label predicates that map
112+
onto label columns such as ``label__Cat``. For example, Cat and Dog can both
113+
carry an ``Animal`` label while still preserving separate Cat and Dog
114+
property contracts.
105115

106116
``NodeType.to_arrow()`` and ``EdgeType.to_arrow()``
107117
Export declarations as ``pyarrow.Schema`` objects through GFQL's row-schema
@@ -198,12 +208,17 @@ The public schema is consumed by local validation APIs, including:
198208
``gfql_remote(...)`` is different. It compiles Cypher strings locally and sends
199209
the resulting GFQL wire payload to the server, but this release does **not**
200210
serialize a bound ``GraphSchema`` into remote GFQL requests. Remote execution
201-
therefore still depends on the server-side dataset schema and GFQL support. If
202-
you want declared schema checks before a remote call, run
211+
therefore still depends on the server-side dataset metadata and GFQL support. If
212+
you want local declared-schema checks before a remote call, run
203213
``g.gfql_validate(query)`` locally first, then call ``g.gfql_remote(query)``.
204214

205215
Remote schema transport is planned as a follow-on after the local schema
206-
contract and serialization boundary are stable.
216+
contract and serialization boundary are stable. The intended direction is a
217+
versioned graph-schema envelope derived from ``GraphSchema.to_arrow()``: exact
218+
Arrow schemas for merged node/edge tables and per-type declarations, plus a
219+
JSON summary for dataset metadata, UI, and REST consumers. That future transport
220+
should live beside ``gfql_query`` / ``gfql_operations`` rather than as fake data
221+
tables.
207222

208223
Compatibility Notes
209224
-------------------

graphistry/PlotterBase.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1799,11 +1799,15 @@ def schema(self) -> Optional["GraphSchema"]:
17991799
The returned object is the same schema instance supplied through
18001800
``bind(schema=...)``. The accessor is read-only: use ``bind(schema=...)``
18011801
to attach a schema to a new plotter.
1802+
1803+
This is local declaration introspection only. It does not infer a schema
1804+
from data, fetch a remote dataset schema, or serialize the schema into
1805+
``gfql_remote()`` requests in this release.
18021806
"""
18031807
return self._gfql_schema
18041808

18051809
def has_schema(self) -> bool:
1806-
"""Return ``True`` when this plotter has a GFQL ``GraphSchema`` bound."""
1810+
"""Return ``True`` when this plotter has a local GFQL schema bound."""
18071811
return self._gfql_schema is not None
18081812

18091813
def copy(self) -> Plottable:

graphistry/tests/compute/gfql/test_public_schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ def test_bind_schema_is_chainable_and_used_by_preflight() -> None:
190190
g = _graph(schema).bind(point_color="name")
191191

192192
assert g._gfql_schema is schema
193+
assert g.schema is schema
194+
assert g.has_schema() is True
193195
report = g.gfql_validate("MATCH (p:Person)-[:WORKS_AT]->(c:Company) RETURN p.name AS name")
194196
assert report["ok"] is True
195197

0 commit comments

Comments
 (0)