Skip to content

Commit

Permalink
Refine metadata representation, expand test suite, fix raw DAG node a…
Browse files Browse the repository at this point in the history
…nnotations
  • Loading branch information
m0ar committed Oct 30, 2023
1 parent 3637787 commit 8f9a2cb
Show file tree
Hide file tree
Showing 11 changed files with 1,363 additions and 827 deletions.
2 changes: 1 addition & 1 deletion composites/01-researchObject.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ type ResearchObject
version: CommitID! @documentVersion
title: String! @string(maxLength: 250)
manifest: CID!
metadata: String @string(maxLength: 1024)
metadata: CID
}
4 changes: 2 additions & 2 deletions composites/06-attestation.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ type Attestation
{
source: DID! @documentAccount
version: CommitID! @documentVersion
# 1. Any type of document, shown with relation on reciever end but cannot
# use @documentRelation without specifying the target type
# 1. Any type of document, shown with relation on reciever end but cannot use
# @documentRelation without specifying the target type before interfaces land
# 2. This cannot be a DID, so attestations to people target the Profile
targetID: StreamID!
targetVersion: CommitID!
Expand Down
9 changes: 7 additions & 2 deletions composites/07-researchComponent.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@ type ResearchComponent
accountRelation: LIST,
description: "A contextualized DAG pointer for a research object"
)
@createIndex(fields: [{ path: "dagNode" }])
@createIndex(fields: [{ path: "mimeType" }])
@createIndex(fields: [{ path: "researchObjectVersion" }])
# Don't join index with path as it prevents efficient reverse CID lookups
@createIndex(fields: [{ path: "dagNode" }])
{
owner: DID! @documentAccount
version: CommitID! @documentVersion
name: String! @string(maxLength: 512)
mimeType: String! @string(maxLength: 128)
metadata: CID

# CID not necessarily unique unless listed with path
dagNode: CID!
pathToNode: String! @string(maxLength: 512)

# The associated research object in which this component lives
# The associated research object
researchObjectID: StreamID! @documentReference(model: "ResearchObject")
researchObject: ResearchObject! @relationDocument(property: "researchObjectID")
researchObjectVersion: CommitID!
Expand Down
32 changes: 26 additions & 6 deletions composites/11-annotation.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,46 @@ type Claim @loadModel(id: "$CLAIM_ID") {
id: ID!
}

type ResearchObject @loadModel(id: "$RESEARCH_OBJECT_ID") {
id: ID!
}

type Annotation
@createModel(accountRelation: LIST, description: "Textual commentary")
@createIndex(fields: [{ path: "targetVersion" }])
@createIndex(fields: [{ path: "claimVersion" }])
@createIndex(fields: [{ path: "dagNode" }, { path: "pathToNode" }])
{
owner: DID! @documentAccount
version: CommitID! @documentVersion

# Textual commentary on target
comment: String! @string(maxLength: 1024)

targetID: StreamID! # Research object, researchComponent, or annotation as reply
targetVersion: CommitID!
# Research object context
researchObjectID: StreamID! @documentReference(model: "ResearchObject")
researchObject: ResearchObject! @relationDocument(property: "researchObjectID")
researchObjectVersion: CommitID!

# If target is a component, identify the location of the annotation
# payload. For example a JSON path, line number, or coordinates in a pdf.
path: String @string(maxLength: 512)
# Research component or annotation as reply
# TODO: interface
targetID: StreamID
targetVersion: CommitID

# Alternatively, directly annotate a raw DAG node without a component.
# Path is necessary because CID is not necessarily unique.
dagNode: CID
pathToNode: String @string(maxLength: 512)

# Localization of the annotation payload, depending on file type.
# For example a JSON path, line number, or coordinates.
locationOnFile: String @string(maxLength: 512)

# Optionally tag a claim to contextualise the annotation
claimID: StreamID @documentReference(model: "Claim")
claim: Claim @relationDocument(property: "claimID")
claimVersion: CommitID

metadataPayload: String @string(maxLength: 1024)
# Optionally suggest changes to metadata with a diff
metadataPayload: CID
}
4 changes: 2 additions & 2 deletions composites/additional-relations.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ type ResearchObject @loadModel(id: "$RESEARCH_OBJECT_ID") {

researchFields: [ResearchFieldRelation] @relationFrom(model: "ResearchFieldRelation", property: "researchObjectID")

annotations: [Annotation] @relationFrom(model: "Annotation", property: "targetID")
annotationCount: Int! @relationCountFrom(model: "Annotation", property: "targetID")
annotations: [Annotation] @relationFrom(model: "Annotation", property: "researchObjectID")
annotationCount: Int! @relationCountFrom(model: "Annotation", property: "researchObjectID")
}

# Support for incoming relations on CeramicAccounts is coming, but we'd need a separate
Expand Down
Loading

0 comments on commit 8f9a2cb

Please sign in to comment.