# JSON-LD Entity Graph Resolver — Schema.org to Knowledge Graph (`subimpact/jsonld-entity-graph-resolver`) Actor

Extract deeply nested JSON-LD, validate against Schema.org (979 types, 1,633 properties), and resolve disconnected blocks into one unified knowledge graph with typed edges. No browser, no API keys, no LLM. First 3 pages free.

- **URL**: https://apify.com/subimpact/jsonld-entity-graph-resolver.md
- **Developed by:** [subimpact](https://apify.com/subimpact) (community)
- **Categories:** AI, Developer tools, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 page processeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## JSON-LD Entity Graph Resolver

Crawls web pages, extracts **deeply nested JSON-LD schema blocks**, validates them against the **Schema.org ontology** (979 types, 1,633 properties, full hierarchy), and maps disconnected schemas into a **clean, unified knowledge graph** — nodes with resolved `@id` references plus typed edges.

**No browser, no API keys, no LLM.** JSON-LD is server-rendered by definition, so this actor uses a plain HTTP fetch — 10× cheaper than browser-based extractors in the same lane.

### What you get per page

| Field | Description |
|---|---|
| `block_count` | Number of `<script type="application/ld+json">` blocks found |
| `types_found` | Valid schema.org types on the page (e.g. `Article`, `Organization`, `Product`) |
| `validation` | Per-page report: valid types, **unknown types**, **invalid properties** |
| `graph` | Unified knowledge graph: `nodes` (id, types, properties) + `edges` (subject, predicate, object) |
| `raw_blocks` | Parsed JSON-LD blocks verbatim (opt-in) |

### The graph resolver

Most pages ship **multiple disconnected JSON-LD blocks** — a `WebSite` block, a `NewsMediaOrganization` block, an `Article` block — often referencing each other by `@id` fragments (`#publisher`) or absolute URLs. This actor:

1. **Flattens** every typed node from every block.
2. **Indexes** nodes by resolved `@id` (fragments resolve against the page URL).
3. **Walks** every property; reference strings and nested typed objects become **edges**.
4. **Emits** one unified graph: `{"@context": "https://schema.org/", "pageUrl": ..., "nodes": [...], "edges": [...]}`.

Example — NYT homepage: the `WebSite` block and the `NewsMediaOrganization` block (`@id: https://www.nytimes.com/#publisher`) become two nodes joined by an edge, instead of two orphan schemas.

### Validation

The bundled Schema.org snapshot (from the official schema.org release) powers:

- **Type validation** — is `@type` a real schema.org class? (Handles `schema:` prefixes and fragments.)
- **Property validation** — are the node's properties real schema.org properties?
- **Hierarchy** — every type's ancestors up to `Thing` are available for downstream reasoning.

Unknown types and invalid properties are reported per page — they are **not** errors, just signals (custom vocabularies, typos, or vendor extensions).

### Pricing

Pay per event, usage billed to you:

| Event | Price |
|---|---|
| Actor start | $0.010 (once per run) |
| Page processed | $0.003 (only pages with ≥1 JSON-LD block) |
| Pages with no JSON-LD | **Free** |

First **3 pages per run are free**. `maxChargeUsd` caps the run's total charge; `estimateOnly` runs the full extraction and reports cost without charging.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `startUrls` | array | — | Pages to extract from. `[{"url": "https://.../"}]` |
| `validateSchema` | boolean | `true` | Validate types/properties against Schema.org |
| `resolveGraph` | boolean | `true` | Build the unified knowledge graph |
| `includeRawBlocks` | boolean | `false` | Include parsed JSON-LD blocks verbatim |
| `maxChargeUsd` | number | `5.0` | Hard cap on total charge per run |
| `estimateOnly` | boolean | `false` | Dry run — report cost, charge nothing |
| `proxyConfiguration` | object | auto | Apify proxy for IP rotation |

### Use cases

- **SEO / structured-data QA** — validate schema markup across a site, find unknown types and invalid properties before Google's Rich Results tester does.
- **Entity extraction for RAG / knowledge graphs** — turn a page's disconnected schemas into one queryable graph.
- **Competitive schema intelligence** — what entities does a competitor's site declare? (Types, `@id` targets, publisher/author graphs.)
- **Schema drift monitoring** — track `types_found` and validation reports over time.

### Limits

- 50 JSON-LD blocks / 500 nodes / 2,000 edges per page (hard caps).
- 4 MB max page size, 25 s fetch timeout.
- Malformed JSON-LD blocks are skipped silently (common in the wild).
- Pages behind WAFs / bot walls may need the Apify proxy or a browser-based actor.

### Tech notes

- Plain HTTP fetch (urllib) — no Playwright, no browser, no LLM.
- Schema.org ontology bundled in the image (no network calls at runtime).
- Tolerant parser: HTML entities, trailing commas, BOM, `@graph` containers.
- `@id` resolution handles absolute URLs, `//host`, `/root`, `#fragment`, and relative paths.

# Actor input Schema

## `startUrls` (type: `array`):

List of pages to extract JSON-LD from. Each entry: {"url": "https://.../"}

## `validateSchema` (type: `boolean`):

Check every @type and property against the bundled Schema.org ontology (979 types, 1,633 properties). Reports unknown types and invalid properties per page.

## `resolveGraph` (type: `boolean`):

Resolve @id references across all blocks on the page and emit a unified graph: nodes (id, types, properties) + edges (subject, predicate, object). Disconnected schemas become one graph.

## `includeRawBlocks` (type: `boolean`):

Also store the parsed JSON-LD blocks verbatim in each row (useful for debugging or downstream processing).

## `maxChargeUsd` (type: `number`):

Hard ceiling on what this run may charge. Once reached, no further events are billed.

## `estimateOnly` (type: `boolean`):

Run the full extraction and report what it would cost, without charging anything.

## `proxyConfiguration` (type: `object`):

Apify proxy for IP rotation. Leave default for automatic proxy.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://en.wikipedia.org/wiki/Artificial_intelligence"
    },
    {
      "url": "https://www.nytimes.com/"
    }
  ],
  "validateSchema": true,
  "resolveGraph": true,
  "includeRawBlocks": false,
  "maxChargeUsd": 5,
  "estimateOnly": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `url` (type: `string`):

The requested URL

## `status` (type: `string`):

success | no-jsonld | error

## `http_status` (type: `string`):

HTTP status code of the fetch

## `final_url` (type: `string`):

URL after redirects

## `content_type` (type: `string`):

Content-Type header of the response

## `block_count` (type: `string`):

Number of JSON-LD blocks found on the page

## `node_count` (type: `string`):

Number of typed nodes in the resolved graph

## `edge_count` (type: `string`):

Number of edges in the resolved graph

## `types_found` (type: `string`):

Valid schema.org types found on the page

## `validation` (type: `string`):

Schema.org validation: valid/unknown types, invalid properties

## `graph` (type: `string`):

Unified graph: nodes + edges with resolved @id references

## `raw_blocks` (type: `string`):

Parsed JSON-LD blocks verbatim (only when includeRawBlocks is true)

## `error` (type: `string`):

Error message when status is error

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://en.wikipedia.org/wiki/Artificial_intelligence"
        },
        {
            "url": "https://www.nytimes.com/"
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("subimpact/jsonld-entity-graph-resolver").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": [
        { "url": "https://en.wikipedia.org/wiki/Artificial_intelligence" },
        { "url": "https://www.nytimes.com/" },
    ],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("subimpact/jsonld-entity-graph-resolver").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://en.wikipedia.org/wiki/Artificial_intelligence"
    },
    {
      "url": "https://www.nytimes.com/"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call subimpact/jsonld-entity-graph-resolver --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,subimpact/jsonld-entity-graph-resolver"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/eaizd3I02iyRZr2nc/builds/6r04FCz2sIOiSZpUz/openapi.json
