Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotation lift #18

Merged
merged 4 commits into from
Oct 30, 2023
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 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
37 changes: 29 additions & 8 deletions composites/11-annotation.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,47 @@ 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: "targetID" }])
@createIndex(fields: [{ path: "claimID" }])
@createIndex(fields: [{ path: "researchObjectID" }])
@createIndex(fields: [{ path: "dagNode" }])
{
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