Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/connectors/jsonld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class JsonLdConnector implements Connector {
// Extract document properties
const docId = data["@id"] as string | undefined
const docType = data["@type"] as string | string[] | undefined
const docLabel = data["label"] || data["name"] || data["rdfs:label"]
const docLabel = (data["label"] ?? data["name"] ?? data["rdfs:label"]) as string | string[] | undefined
const docCreator = data["creator"] || data["dcterms:creator"]
const docDate = data["date"] || data["dcterms:created"] || data["dcterms:issued"]
const docDescription = data["description"] || data["dcterms:description"]
Expand Down
5 changes: 5 additions & 0 deletions src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export interface Labeled {
* It may be real, conceptual, lost, inferred, disputed, or represented only indirectly.
*/
export interface Thing extends RcmObject, Labeled {
/** Indicates this Thing is a provisional placeholder for an unresolved entity */
"rcm:placeholder"?: boolean;
/** Optional list of provisional identifiers or evidence IDs associated with this placeholder */
"rcm:provisionalIds"?: string[];

"@type": "crm:E22_Human-Made_Object" | "schema:Person" | "schema:Place" | "schema:Event" | "schema:Thing" | string;
"rcm:lifecycle"?: "encountered" | "anchored" | "described" | "related" | "reconciled" | "absorbed" | "invalidated";
}
Expand Down
39 changes: 39 additions & 0 deletions src/ui/entity-workbench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Entity Workbench – Placeholder creation and lacuna handling

import type { Thing } from "../core/types.js";

/**
* Create a provisional placeholder Thing.
*
* @param label Human‑readable label for the placeholder (e.g., "Unnamed Artifact")
* @param provisionalIds Optional IDs or evidence references that justify the placeholder
* @returns A Thing object marked as a placeholder.
*/
export function createPlaceholderThing(label: string, provisionalIds?: string[]): Thing {
const placeholder: Thing = {
"@id": `_:placeholder-${Date.now()}`,
"@type": "schema:Thing",
"rcm:placeholder": true,
"rdfs:label": label,
"rcm:provisionalIds": provisionalIds ? [...provisionalIds] : [],
};
return placeholder;
}

/**
* Simple utility to merge two provisional Things, marking them as a single lacuna.
* Returns a new Thing with combined provisionalIds.
*/
export function mergePlaceholders(a: Thing, b: Thing): Thing {
if (!a["rcm:placeholder"] || !b["rcm:placeholder"]) {
throw new Error("Both inputs must be placeholders");
}
const merged: Thing = {
"@id": `_:merged-${Date.now()}`,
"@type": "schema:Thing",
"rcm:placeholder": true,
"rdfs:label": `${a["rdfs:label"]} / ${b["rdfs:label"]}`,
"rcm:provisionalIds": [...(a["rcm:provisionalIds"] ?? []), ...(b["rcm:provisionalIds"] ?? [])],
};
return merged;
}
1 change: 1 addition & 0 deletions src/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export * from "./publication.js";
export * from "./action-registry.js";
export * from "./viewer-registry.js";
export * from "./proposal-review.js";
export * from "./entity-workbench.js";
2 changes: 1 addition & 1 deletion src/ui/proposal-review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export class ProposalReview extends HTMLElement {
}

return this.result.annotations.map(ann => {
const body = ann["oa:hasBody"] || ann.body;
const body = ann["oa:hasBody"];
const predicate = body?.["rcm:predicate"] || body?.predicate || "";
const object = body?.["rcm:object"] || body?.object || "";

Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/entity-workbench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Entity Workbench fixtures – placeholder examples
import { createPlaceholderThing } from "../../src/ui/entity-workbench.js";

/** Placeholder for an unnamed artifact with evidence IDs */
export const placeholderArtifact = createPlaceholderThing("Unnamed Artifact", ["evidence-123", "evidence-456"]);
Loading