Skip to main content

Module types

Module types 

Source
Expand description

Core data types for Schema.org structured data extraction.

This module defines the shared data model used across all extraction formats (JSON-LD, Microdata, RDFa Lite). The central type is SchemaNode, which represents a single structured data entity (e.g. a Product, an Offer). Nodes contain typed SchemaValues organized in insertion-ordered property maps.

§Data Model

StructuredDataGraph
  +---- Vec<SchemaNode>
        +---- types: ["Product"]
        +---- properties: { "name" -> [Text("Widget")],
        |                  "offers" -> [Node(Offer { ... })] }
        +---- source_format: JsonLd
        +---- source_location: Some({ line: 3, column: 1, byte_offset: 42 })

§Examples

use schemaorg_rs::types::{SchemaNode, SchemaValue, SourceFormat};
use indexmap::IndexMap;

let node = SchemaNode {
    types: vec!["Product".into()],
    properties: IndexMap::from([(
        "name".into(),
        vec![SchemaValue::Text("Widget".into())],
    )]),
    source_format: SourceFormat::JsonLd,
    source_location: None,
};

assert_eq!(node.types, vec!["Product"]);

Structs§

SchemaNode
A single structured data node (e.g. a Product, an Offer).
SourceLocation
Location in the original HTML document.

Enums§

SchemaValue
A value within a structured data node.
SourceFormat
Source format of the extracted structured data.