Graphlit Platform
Developer PortalChangelogPlatform StatusMore InformationJoin Discord
  • Graphlit Platform
    • What is Graphlit?
    • Key Concepts
  • Getting Started
    • Sign up for Graphlit
    • Create Graphlit Project
    • For Python Developers
    • For Node.js Developers
    • For .NET Developers
  • 🚀Quickstart
    • Next.js applications
      • GitHub Code
    • Python applications
      • GitHub Code
  • Graphlit Data API
    • API Usage
      • API Endpoints
      • API Authentication
      • API Explorer
      • GraphQL 101
    • API Reference
      • Content
        • Ingest With Workflow
        • Ingest File
        • Ingest Encoded File
        • Ingest Web Page
        • Ingest Text
        • Semantic Search
          • Query All Content
          • Query Facets
          • Query By Name
          • Filter By Contents
        • Metadata Filtering
          • Filter By Observations
          • Filter By Feeds
          • Filter By Collections
          • Filter By Content Type
          • Filter By File Type
          • Filter By File Size Range
          • Filter By Date Range
        • Summarize Contents
        • Extract Contents
        • Publish Contents
      • Knowledge Graph
        • Labels
        • Categories
        • Persons
        • Organizations
        • Places
        • Events
        • Products
        • Repos
        • Software
      • Collections
      • Feeds
        • Create Feed With Workflow
        • Create RSS Feed
        • Create Podcast Feed
        • Create Web Feed
        • Create Web Search Feed
        • Create Reddit Feed
        • Create Notion Feed
        • Create YouTube Feed
        • User Storage Feeds
          • Create OneDrive Feed
          • Create Google Drive Feed
          • Create SharePoint Feed
        • Cloud Storage Feeds
          • Create Amazon S3 Feed
          • Create Azure Blob Feed
          • Create Azure File Feed
          • Create Google Blob Feed
        • Messaging Feeds
          • Create Slack Feed
          • Create Microsoft Teams Feed
          • Create Discord Feed
        • Email Feeds
          • Create Google Mail Feed
          • Create Microsoft Outlook Feed
        • Issue Feeds
          • Create Linear Feed
          • Create Jira Feed
          • Create GitHub Issues Feed
        • Configuration Options
      • Workflows
        • Ingestion
        • Indexing
        • Preparation
        • Extraction
        • Enrichment
        • Actions
      • Conversations
      • Specifications
        • Azure OpenAI
        • OpenAI
        • Anthropic
        • Mistral
        • Groq
        • Deepseek
        • Replicate
        • Configuration Options
      • Alerts
        • Create Slack Audio Alert
        • Create Slack Text Alert
      • Projects
    • API Changelog
    • Multi-tenant Applications
  • JSON Mode
    • Overview
    • Document JSON
    • Transcript JSON
  • Content Types
    • Files
      • Documents
      • Audio
      • Video
      • Images
      • Animations
      • Data
      • Emails
      • Code
      • Packages
      • Other
    • Web Pages
    • Text
    • Posts
    • Messages
    • Emails
    • Issues
  • Data Sources
    • Feeds
  • Platform
    • Developer Portal
      • Projects
    • Cloud Platform
      • Security
      • Subprocessors
  • Resources
    • Community
Powered by GitBook
On this page
  • Filter By Category
  • Query Categories
  • Query Contents

Was this helpful?

  1. Graphlit Data API
  2. API Reference
  3. Content
  4. Metadata Filtering

Filter By Observations

Filter content by observation(s) in your Graphlit project.

As content is processed through the configured workflow, Graphlit observes entities such as labels, categories, persons or organizations in the text of your documents, the transcripts of your audio or video files, or even within images.

We call these observations of observables (i.e. observed entities).

You can filter for content which has observed one or more entities, such as a specific person and label and organization. These queries leverage the knowledge graph to find connections between these observed entities and across your content.

Filter By Category

In this example, we will query for the observed categories in the knowledge graph, which contain the word Phone.

Query Categories

Query:

query QueryCategories($filter: CategoryFilter!) {
  categories(filter: $filter) {
    results {
      id
      name
    }
  }
}

Variables:

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

Response:

{
  "results": [
    {
      "id": "a3edf984-9e28-4629-b1e4-c0d35c8e4f8a",
      "name": "Phone Number"
    }
  ]
}

Then, by specifying the observations field in the GraphQL content filter object, you can filter your content by this category. (You can provide one or more observations in the array.)

For the observation, you will specify the observableType field as CATEGORY and the observable reference, which takes the ID of the category above.

In the observations field of the GraphQL response, you will find a list of occurrences, which specific the type and location where the category was found.

In this case, it was found multiple times, across multiple pages, of this document. Each occurrence contains a confidence score (between 0.0 and 1.0) of how confident the AI was in observing this entity.

Query Contents

Query:

query QueryContents($filter: ContentFilter!) {
  contents(filter: $filter) {
    results {
      id
      name
      creationDate
      state
      owner {
        id
      }
      originalDate
      finishedDate
      workflowDuration
      uri
      text
      type
      fileType
      mimeType
      fileName
      fileSize
      masterUri
      mezzanineUri
      transcriptUri
      observations {
        id
        observableType
        observable {
          id
          name
        }
        occurrences {
          occurrenceType
          confidence
          startTime
          endTime
          pageIndex
          boundingBox {
            left
            top
            width
            height
          }
        }
      }
    }
  }
}

Variables:

{
  "filter": {
    "observations": [
      {
        "observableType": "CATEGORY",
        "observable": {
          "id": "a3edf984-9e28-4629-b1e4-c0d35c8e4f8a"
        }
      }
    ],
    "queryType": "SIMPLE",
    "searchType": "VECTOR",
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "type": "FILE",
      "originalDate": "2015-12-03T20:01:00Z",
      "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      "fileType": "DOCUMENT",
      "fileName": "Test Credit Card Account Numbers.docx",
      "fileSize": 20506,
      "masterUri": "https://graphlit20230804f85c04ec.blob.core.windows.net/files/f80b07d9-540c-490a-9c10-04c8b28f11bd/Test%20Credit%20Card%20Account%20Numbers.docx",
      "mezzanineUri": "https://graphlit20230804f85c04ec.blob.core.windows.net/files/f80b07d9-540c-490a-9c10-04c8b28f11bd/Mezzanine/Test%20Credit%20Card%20Account%20Numbers.json",
      "observations": [
        {
          "observableType": "CATEGORY",
          "observable": {
            "name": "Phone Number",
            "id": "a3edf984-9e28-4629-b1e4-c0d35c8e4f8a"
          },
          "occurrences": [
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            }
          ],
          "id": "0702f4f0-eaa5-4c2b-912f-54920832dadd"
        },
        {
          "observableType": "CATEGORY",
          "observable": {
            "name": "Credit Card Number",
            "id": "c8857e63-eb66-4b70-a495-e51822a669df"
          },
          "occurrences": [
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            }
          ],
          "id": "dfc5271e-af65-4f50-97de-8b96c83dd8b4"
        },
        {
          "observableType": "CATEGORY",
          "observable": {
            "name": "EU Debit Card Number",
            "id": "dfaa31ad-f1e1-4a18-9b12-d17c22575dd1"
          },
          "occurrences": [
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            }
          ],
          "id": "06e75569-bd66-4b51-8678-a27c09694c69"
        }
      ],
      "uri": "redacted",
      "id": "f80b07d9-540c-490a-9c10-04c8b28f11bd",
      "name": "Test Credit Card Account Numbers",
      "state": "FINISHED",
      "creationDate": "2023-08-04T03:36:21Z",
      "finishedDate": "2023-08-04T03:36:36Z",
      "workflowDuration": "PT14.6647643S",
      "owner": {
        "id": "ad8154c6-bd6c-4782-a689-d1cd4ffb0693"
      }
    }
  ]
}

Last updated 1 year ago

Was this helpful?