@valueflows/vf-graphql
Version:
Reference GraphQL implementation of the ValueFlows spec
408 lines (300 loc) • 12.6 kB
JavaScript
// Generated by scripts/build.js - edit the *.gql file instead!
module.exports = `
##
#
# Agent module
#
# All functionality related to the definition of autonomous agents
# (people, organizations, groups) and their relationships.
#
# @package vf-graphql
# @since 2019-02-11
#
##
"""
A boundary or context grouped around some other record- used for documenting, accounting, planning.
"""
union AccountingScope = Person | Organization
"""
A person or group or organization with economic agency.
"""
interface Agent {
id: ID!
revisionId: ID!
"An informal or formal textual identifier for an agent. Does not imply uniqueness."
name: String!
"The uri to an image relevant to the agent, such as a logo, avatar, photo, etc."
image: URI
"A textual description or comment."
note: String
##############################################################################
# inverse relationships and queries
relationships(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
relationshipsAsSubject(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
relationshipsAsObject(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
roles: [AgentRelationshipRole!]
}
"""
A natural person.
"""
type Person implements Agent {
id: ID!
revisionId: ID!
"The name that this agent will be referred to by."
name: String!
"The uri to an image relevant to the agent, such as a logo, avatar, photo, etc."
image: URI
"A textual description or comment."
note: String
##############################################################################
# inverse relationships and queries
relationships(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
relationshipsAsSubject(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
relationshipsAsObject(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
roles: [AgentRelationshipRole!]
}
"""
A formal or informal group, or legal organization.
"""
type Organization implements Agent {
id: ID!
revisionId: ID!
# :TODO: define how people can create further typing of Organization
# type: OrganizationClassification
"The name that this agent will be referred to by."
name: String!
"The uri to an image relevant to the agent, such as a logo, avatar, photo, etc."
image: URI
"References one or more concepts in a common taxonomy or other classification scheme for purposes of categorization or grouping."
classifiedAs: [URI!]
"A textual description or comment."
note: String
##############################################################################
# inverse relationships and queries
relationships(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
relationshipsAsSubject(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
relationshipsAsObject(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
roles: [AgentRelationshipRole!]
}
# Relationships between agents
"""
The role of an economic relationship that exists between 2 agents, such as member, trading partner.
"""
type AgentRelationship {
id: ID!
revisionId: ID!
"The subject of a relationship between 2 agents. For example, if Mary is a member of a group, then Mary is the subject."
subject: Agent!
"The object of a relationship between 2 agents. For example, if Mary is a member of a group, then the group is the object."
object: Agent!
"A kind of relationship that exists between 2 agents."
relationship: AgentRelationshipRole!
"Grouping around something to create a boundary or context, used for documenting, accounting, planning."
inScopeOf: [AccountingScope!]
"A textual description or comment."
note: String
}
"""
A relationship role defining the kind of association one agent can have with another.
"""
type AgentRelationshipRole {
id: ID!
revisionId: ID!
"The human readable name of the role, from the subject to the object."
roleLabel: String!
"The human readable name of the role, from the object to the subject."
inverseRoleLabel: String
"A textual description or comment."
note: String
# :TODO: https://github.com/valueflows/valueflows/issues/494
# inverse relationships and queries
agentRelationships(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection
}
# :TODO: how do we want to do this concept?
# """
# Generalized behaviors for agent relationship roles
# """
# enum AgentRelationshipCategory {
# LEGALPARTNER
# MEMBER
# PART
# PEER
# TRADINGPARTNER
# }
input AgentCreateParams { # implements AgentParams
"An informal or formal textual identifier for an agent. Does not imply uniqueness."
name: String!
"The uri to an image relevant to the agent, such as a logo, avatar, photo, etc."
image: URI
"A textual description or comment."
note: String
}
input AgentUpdateParams { # implements UpdateParams & AgentParams
revisionId: ID!
"An informal or formal textual identifier for an agent. Does not imply uniqueness."
name: String
"The uri to an image relevant to the agent, such as a logo, avatar, photo, etc."
image: URI
"A textual description or comment."
note: String
}
input OrganizationCreateParams { # implements AgentParams
"An informal or formal textual identifier for an agent. Does not imply uniqueness."
name: String!
"The uri to an image relevant to the agent, such as a logo, avatar, photo, etc."
image: URI
"References one or more concepts in a common taxonomy or other classification scheme for purposes of categorization or grouping."
classifiedAs: [URI!]
"A textual description or comment."
note: String
}
input OrganizationUpdateParams { # implements UpdateParams & AgentParams
revisionId: ID!
"An informal or formal textual identifier for an agent. Does not imply uniqueness."
name: String
"The uri to an image relevant to the agent, such as a logo, avatar, photo, etc."
image: URI
"References one or more concepts in a common taxonomy or other classification scheme for purposes of categorization or grouping."
classifiedAs: [URI!]
"A textual description or comment."
note: String
}
type PersonResponse {
agent: Person!
}
type OrganizationResponse {
agent: Organization!
}
input AgentRelationshipCreateParams { # implements AgentRelationshipParams
"(\`Agent\`) The subject of a relationship between 2 agents. For example, if Mary is a member of a group, then Mary is the subject."
subject: ID! # Agent
"(\`Agent\`) The object of a relationship between 2 agents. For example, if Mary is a member of a group, then the group is the object."
object: ID! # Agent
"(\`AgentRelationshipRole\`) The role of an economic relationship that exists between 2 agents, such as member, trading partner."
relationship: ID! # AgentRelationshipRole
"(\`AccountingScope\`) Grouping around something to create a boundary or context, used for documenting, accounting, planning."
inScopeOf: [ID!]
"A textual description or comment."
note: String
}
input AgentRelationshipUpdateParams { # implements UpdateParams & AgentRelationshipParams
revisionId: ID!
"(\`Agent\`) The subject of a relationship between 2 agents. For example, if Mary is a member of a group, then Mary is the subject."
subject: ID
"(\`Agent\`) The object of a relationship between 2 agents. For example, if Mary is a member of a group, then the group is the object."
object: ID
"(\`AgentRelationshipRole\`) The role of an economic relationship that exists between 2 agents, such as member, trading partner."
relationship: ID
"(\`AccountingScope\`) Grouping around something to create a boundary or context, used for documenting, accounting, planning."
inScopeOf: [ID!]
"A textual description or comment."
note: String
}
type AgentRelationshipResponse {
agentRelationship: AgentRelationship!
}
input AgentRelationshipRoleCreateParams { # implements AgentRelationshipRoleParams
"The human readable name of the role, inverse from the object to the subject. For example, 'is member of'."
roleLabel: String!
"The human readable name of the role, inverse from the object to the subject. For example, 'has member'."
inverseRoleLabel: String
"A textual description or comment."
note: String
}
input AgentRelationshipRoleUpdateParams { # implements UpdateParams & AgentRelationshipRoleParams
revisionId: ID!
"The human readable name of the role, inverse from the object to the subject. For example, 'is member of'."
roleLabel: String
"The human readable name of the role, inverse from the object to the subject. For example, 'has member'."
inverseRoleLabel: String
"A textual description or comment."
note: String
}
type AgentRelationshipRoleResponse {
agentRelationshipRole: AgentRelationshipRole
}
type AgentConnection {
edges: [AgentEdge!]!
pageInfo: PageInfo!
}
type AgentEdge {
node: Agent!
cursor: String!
}
type PersonConnection {
edges: [PersonEdge!]!
pageInfo: PageInfo!
}
type PersonEdge {
node: Person!
cursor: String!
}
type OrganizationConnection {
edges: [OrganizationEdge!]!
pageInfo: PageInfo!
}
type OrganizationEdge {
node: Organization!
cursor: String!
}
type AgentRelationshipConnection {
edges: [AgentRelationshipEdge!]!
pageInfo: PageInfo!
}
type AgentRelationshipEdge {
node: AgentRelationship!
cursor: String!
}
type AgentRelationshipRoleConnection {
edges: [AgentRelationshipRoleEdge!]!
pageInfo: PageInfo!
}
type AgentRelationshipRoleEdge {
node: AgentRelationshipRole!
cursor: String!
}
type Query {
"Loads details of the currently authenticated REA agent"
myAgent: Agent
"Find an agent (person or organization) by their ID"
agent(id: ID!): Agent
"Loads all agents publicly registered within this collaboration space"
agents(first: Int, after: String, last: Int, before: String): AgentConnection!
"Find an organization (group) agent by its ID"
organization(id: ID!): Organization
"Loads all organizations publicly registered within this collaboration space"
organizations(first: Int, after: String, last: Int, before: String): OrganizationConnection!
"Find a person by their ID"
person(id: ID!): Person
"Loads all people who have publicly registered with this collaboration space."
people(first: Int, after: String, last: Int, before: String): PersonConnection!
"Retrieve details of an agent relationship by its ID"
agentRelationship(id: ID!): AgentRelationship
"Retrieve details of all the relationships between all agents registered in this collaboration space"
agentRelationships(first: Int, after: String, last: Int, before: String): AgentRelationshipConnection!
"Retrieve details of an agent relationship role by its ID"
agentRelationshipRole(id: ID!): AgentRelationshipRole
"Retrieve all possible kinds of associations that agents may have with one another in this collaboration space"
agentRelationshipRoles(first: Int, after: String, last: Int, before: String): AgentRelationshipRoleConnection!
}
type Mutation {
"Registers a new (human) person with the collaboration space"
createPerson(person: AgentCreateParams!): PersonResponse!
"Update profile details"
updatePerson(person: AgentUpdateParams!): PersonResponse!
"Erase record of a person and thus remove them from the collaboration space"
deletePerson(revisionId: ID!): Boolean!
"Registers a new organization (group agent) with the collaboration space"
createOrganization(organization: OrganizationCreateParams!): OrganizationResponse!
"Update organization profile details"
updateOrganization(organization: OrganizationUpdateParams!): OrganizationResponse!
"Erase record of an organization and thus remove it from the collaboration space"
deleteOrganization(revisionId: ID!): Boolean!
createAgentRelationship(relationship: AgentRelationshipCreateParams!): AgentRelationshipResponse!
updateAgentRelationship(relationship: AgentRelationshipUpdateParams!): AgentRelationshipResponse!
deleteAgentRelationship(revisionId: ID!): Boolean!
createAgentRelationshipRole(agentRelationshipRole: AgentRelationshipRoleCreateParams!): AgentRelationshipRoleResponse!
updateAgentRelationshipRole(agentRelationshipRole: AgentRelationshipRoleUpdateParams!): AgentRelationshipRoleResponse!
deleteAgentRelationshipRole(revisionId: ID!): Boolean!
}
`