Labels

Create, manage and query Labels.

Overview

Labels are the most generic entity type, which can be thought of as a topic or tag. They are unique by their name, across the Graphlit project.

Operations

Create Label

The createLabel mutation enables the creation of a label by accepting the label name and it returns essential details, including the ID and name of the newly generated label.

Mutation:

mutation CreateLabel($label: LabelInput!) {
  createLabel(label: $label) {
    id
    name
  }
}

Variables:

{
  "label": {
    "name": "Sentiment"
  }
}

Response:

{
  "id": "80ab6aa0-6d75-4500-99dd-60b9e6751c85",
  "name": "Sentiment"
}
Update Label

The updateLabel mutation enables the renaming of a label by accepting the label name.

Mutation:

mutation UpdateLabel($label: LabelUpdateInput!) {
  updateLabel(label: $label) {
    id
    name
  }
}

Variables:

{
  "label": {
    "id": "80ab6aa0-6d75-4500-99dd-60b9e6751c85",
    "name": "Sentiment Score"
  }
}

Response:

{
  "id": "80ab6aa0-6d75-4500-99dd-60b9e6751c85",
  "name": "Sentiment Score"
}
Delete Label

The deleteLabel mutation allows the deletion of a label by utilizing the id parameter, and it returns the ID and state of the deleted label.

Mutation:

mutation DeleteLabel($id: ID!) {
  deleteLabel(id: $id) {
    id
    state
  }
}

Variables:

{
  "id": "80ab6aa0-6d75-4500-99dd-60b9e6751c85"
}

Response:

{
  "id": "80ab6aa0-6d75-4500-99dd-60b9e6751c85",
  "state": "DELETED"
}
Delete Labels

The deleteLabels mutation allows the deletion of multiple labels, as specified by the ids array parameter, and it returns the ID and state of the deleted labels.

Mutation:

mutation DeleteLabels($ids: [ID!]!) {
  deleteLabels(ids: $ids) {
    id
    state
  }
}

Variables:

{
  "ids": [
    "39fcf408-15ca-4cc2-9476-622d64aa38f3",
    "93476a0c-d567-4624-9d5e-df43dfff92ea"
  ]
}

Response:

[
  {
    "id": "93476a0c-d567-4624-9d5e-df43dfff92ea",
    "state": "DELETED"
  },
  {
    "id": "39fcf408-15ca-4cc2-9476-622d64aa38f3",
    "state": "DELETED"
  }
]
Get Label

The label query allows you to retrieve specific details of a label by providing the id parameter.

Query:

query GetLabel($id: ID!) {
  label(id: $id) {
    id
    name
  }
}

Variables:

{
  "id": "80ab6aa0-6d75-4500-99dd-60b9e6751c85"
}

Response:

{
  "id": "80ab6aa0-6d75-4500-99dd-60b9e6751c85",
  "name": "Sentiment Score"
}
Query Labels

Query Labels

The labels query allows you to retrieve all labels. It returns a list of label results, including the ID and name for each label.

Query:

query QueryLabels($filter: LabelFilter!) {
  labels(filter: $filter) {
    results {
      id
      name
    }
  }
}

Variables:

{
  "filter": {
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "id": "6fc7b16f-c6f0-4eba-ac90-cdd4b91dc937",
      "name": "Contextualization"
    },
    {
      "id": "3c4ff7f8-b9ae-4131-9ade-071ba4679986",
      "name": "Databases"
    },
    {
      "id": "ef9679ea-e293-4bfa-9ba2-6dc79f0c549f",
      "name": "Predictive Model"
    },
    {
      "id": "0e5ca152-c196-4a08-9ba7-02908ffbf391",
      "name": "Visual Analytics"
    },
    {
      "id": "c6fd585e-71d5-47c4-a4dc-72b039ee5e77",
      "name": "Industrial Applications"
    },
    {
      "id": "f0d4270c-c2a3-4e8f-9f77-1b1a33d6709f",
      "name": "Data Modeling"
    },
    {
      "id": "b57ff853-f72b-40ad-94cc-6b88556fe451",
      "name": "Data Collaboration"
    },
    {
      "id": "65ac622d-3fd5-4b8e-80fc-8e6ac44356c2",
      "name": "Sales Engineering"
    },
    {
      "id": "da1f6735-6e25-4e6e-ba57-47d919a4509f",
      "name": "Engineering"
    },
    {
      "id": "79ce2cc5-7404-45bf-83b6-13a4a350e085",
      "name": "Robotics"
    },
    {
      "id": "81223a55-84eb-4757-b11f-de53d0f0bfe2",
      "name": "Image Recognition"
    },
    {
      "id": "1573bdab-7df3-400d-8828-e6d6950ad272",
      "name": "Data Management"
    }
  ]
}

Query Labels By Name

The labels query allows you to retrieve labels based on a specific filter criteria, via the name parameter. In this example, the name is set to "Data." It returns a list of label results containing the ID and name for each matching label.

Query:

query QueryLabels($filter: LabelFilter!) {
  labels(filter: $filter) {
    results {
      id
      name
    }
  }
}

Variables:

{
  "filter": {
    "name": "Data",
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "id": "f0d4270c-c2a3-4e8f-9f77-1b1a33d6709f",
      "name": "Data Modeling"
    },
    {
      "id": "b57ff853-f72b-40ad-94cc-6b88556fe451",
      "name": "Data Collaboration"
    },
    {
      "id": "1573bdab-7df3-400d-8828-e6d6950ad272",
      "name": "Data Management"
    },
    {
      "id": "6d6d96b3-fab7-43d0-b253-f9faf8e8b7f1",
      "name": "Data Extraction"
    },
    {
      "id": "62be7173-9ec5-40ea-8c2c-8648dfdd3022",
      "name": "Data Storage"
    },
    {
      "id": "7ba68fda-e8e9-4875-bd49-c0c38996f0ad",
      "name": "Data Models"
    },
    {
      "id": "e5a4d832-0cad-4539-84a2-0f43a5424b7f",
      "name": "Data Discovery"
    }
  ]
}

Last updated