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
Document internal surfaces and the PHP Cypher query path (#1045)
* Document internal surfaces and the PHP Cypher query path
Extensions have started building on two surfaces that are reachable but
internal: the rendered .ext-neowiki-view placeholders and the raw Neo4j
client. NeoWiki is pre-1.0 and cannot yet declare a stable interface,
so the extending docs gain an "Internal surfaces" section: the rendered
HTML is marked as not an integration surface, while the internal client
gets a comparison of what the documented query interfaces provide over
it (read-only enforcement, resource limits, result handling, churn
exposure) rather than a prohibition, plus a warning that direct graph
writes do not survive re-projection or rebuilds.
Since the alternative for PHP-side querying was undocumented, add a
"Running Cypher queries" subsection covering newCypherQueryService(),
backed by a new RedHerb example (SpecialRedHerbContentPageCount) with
an integration test against real Neo4j, so the documented call shape
stays working like the page's other examples.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Drop the apihighlimits mention from the query limits sentence
The tier mechanics are documented on the linked Query API page; naming
the right here duplicated that and it is default MediaWiki behavior.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Address review precision findings on the query docs and example
Docs: name the keyword validator's CALL and SHOW rejection, state that
the row cap truncates only after the query has run (bound work with
LIMIT in the Cypher), scope the durable-write pointer to page-level
key/value metadata and state plainly that arbitrary graph structure has
no durable third-party write path, and qualify projection on save and
rebuild with the Subject-slot requirement.
Example: bind the caught exception and surface its message like the
Scribunto library does, cover the no-backend error branch via
runWithoutGraphBackend(), and rework editMainSubject to resolve the
Main Subject through getSubjectRepository()->getPageSubjects() instead
of scraping the .ext-neowiki-view placeholder the docs forbid; the docs
now cite it as the worked example of that path.
Also exclude tests/RedHerb/node_modules from phpcs: following the
RedHerb README's npm install instructions previously made make phpcs
scan thousands of dependency files and run out of memory.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Tighten internal-surfaces wording from the text-review pass
Name Neo4j in the no-backend LogicException sentence (it matches the
thrown message and stays exact once SPARQL stores can be configured
alongside), state that editMainSubject resolves the Main Subject
through the public JS API instead of the ambiguous "this way", and cut
a sentence restating the section intro's change-without-notice fact.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Jeroen De Dauw <jeroendedauw@proton.me>
and [`src/Specials/SpecialRedHerbSubjectFinder.php`](https://github.com/ProfessionalWiki/NeoWiki/blob/master/tests/RedHerb/src/Specials/SpecialRedHerbSubjectFinder.php).
200
201
202
+
### Running Cypher queries
203
+
204
+
To run a read-only Cypher query from PHP, use `NeoWikiExtension::getInstance()->newCypherQueryService()`.
205
+
It rejects write queries, enforces the timeout against the backend, and truncates results to the row cap;
206
+
resolve the limits configured in [`$wgNeoWikiQueryLimits`](../api/query-api.md) with
207
+
`Neo4jQueryLimits::forUser()`:
208
+
209
+
```php
210
+
$result = NeoWikiExtension::getInstance()->newCypherQueryService()->execute( new Neo4jQueryRequest(
211
+
cypher: 'MATCH (s:Subject:Person) WHERE s.`Birth year` > $minYear RETURN s.name AS name',
Copy file name to clipboardExpand all lines: tests/RedHerb/i18n/qqq.json
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,9 @@
6
6
"redherb-sidebar-create-child-company": "Text of the sidebar link that opens a dialog for creating a child Subject with the Company schema.",
7
7
"redherb-sidebar-subject-finder": "Text of the sidebar link that opens the RedHerb subject finder.",
8
8
"redherb-special-subject-finder": "Title shown on Special:RedHerbSubjectFinder.",
9
+
"redherb-special-content-page-count": "Title shown on Special:RedHerbContentPageCount.",
10
+
"redherb-content-page-count": "Result shown on Special:RedHerbContentPageCount, reporting how many content-namespace pages NeoWiki tracks in the graph. $1 is the count.",
11
+
"redherb-content-page-count-error": "Error shown on Special:RedHerbContentPageCount when the Cypher query fails. $1 is the underlying error message.",
9
12
"redherb-subject-finder-schema-label": "Label of the schema name input on Special:RedHerbSubjectFinder.\n{{Identical|Schema}}",
10
13
"redherb-subject-finder-schema-placeholder": "Placeholder text inside the schema name input on Special:RedHerbSubjectFinder.",
11
14
"redherb-subject-finder-pick-subject": "Label of the subject lookup on Special:RedHerbSubjectFinder.",
0 commit comments