feat: add RFC 3986 relative IRI resolution#9
Conversation
Implements the four missing LDP HTTP methods: - put(): idempotent resource creation/update at a known URI, with optional LDP BasicContainer Link header for container creation - head(): inspect resource metadata without fetching the body - delete(): remove resources or containers - patch(): partial RDF updates via SPARQL Update (default) or N3 Patch Also applies CS Fixer auto-fixes (explicit nullable types, \sprintf). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds ResourceMetadata, a typed value object parsed from HEAD response headers providing: contentType, contentLength, lastModified, ldpType (container vs resource from Link header), wacAllow (parsed permissions), and aclUrl (from Link rel="acl"). Adds getResourceMetadata() to SolidClient as a convenience wrapper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CSS returns expanded JSON-LD by default for Accept: application/ld+json. JsonLdParser uses json_decode directly (not the ml/json-ld processor) since CSS responses are already in expanded form. Provides parse() for normalizing single objects and arrays, and findById() for node lookup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
IriHelper::resolve() implements RFC 3986 §5 for resolving relative references against a base URI. Needed because CSS JSON-LD responses may contain relative @id values that must be resolved against the request URL. Tested against the full RFC 3986 §5.4 normal examples. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
CSS (Community Solid Server) returns JSON-LD with relative @id values when you GET a container with Accept: application/ld+json. For example, GETting http://pod.example/data/: The @id values "file.txt" and "sub/" are relative references — they're not usable as-is. To construct the actual resource URLs (http://pod.example/data/file.txt, getContainerContents() (f259316) uses IriHelper::resolve() on every @id from the JSON-LD response to turn relative references into absolute URLs that can be used for subsequent requests (HEAD, GET, Without it, container listing would only work when CSS happens to return absolute URLs — which it doesn't by default. |
Summary
IriHelper::resolve()implementing RFC 3986 §5 relative reference resolution@idvaluesStack
4/8 — builds on #8 (
feat/jsonld-parsing)Test plan
🤖 Generated with Claude Code