rdf_vocabularies_schema_http 0.4.5 copy "rdf_vocabularies_schema_http: ^0.4.5" to clipboard
rdf_vocabularies_schema_http: ^0.4.5 copied to clipboard

Schema.org vocabulary (HTTP variant) as Dart constants for legacy system compatibility

RDF Vocabularies Schema HTTP - Schema.org HTTP Vocabulary #

pub package build license

Overview #

🌐 Official Homepage

rdf_vocabularies_schema_http provides type-safe access to the Schema.org vocabulary with HTTP URIs as Dart constants for use with rdf_core.

This package contains the legacy Schema.org vocabulary (~36MB) using HTTP URIs (http://schema.org/...) for compatibility with existing data and systems.

πŸ“¦ Package Selection Guide #

Package Download Size Content Best For
rdf_vocabularies_schema_http (this package) ~36MB Schema.org HTTP Legacy compatibility
rdf_vocabularies_schema ~35MB Schema.org HTTPS Modern Schema.org apps
rdf_vocabularies_core ~5MB Core RDF vocabularies Essential vocabularies
rdf_vocabularies ~77MB All vocabularies Full compatibility

πŸ’‘ Recommendation: Use rdf_vocabularies_schema (HTTPS) for new projects. Use this package only for legacy compatibility.

The library is designed for both RDF newcomers and experts, offering structured ways to work with semantic data while maintaining compilation-time safety.


Part of a whole family of projects #

If you are looking for more rdf-related functionality, have a look at our companion projects:

  • basic graph classes as well as turtle/jsonld/n-triple encoding and decoding: rdf_core
  • encode and decode rdf/xml format: rdf_xml
  • generate your own easy-to-use constants for other vocabularies with a build_runner: rdf_vocabulary_to_dart
  • map Dart Objects ↔️ RDF: rdf_mapper

Getting Started #

Installation #

Add the package to your project:

# Install Schema.org HTTP vocabulary (~36MB)
dart pub add rdf_vocabularies_schema_http rdf_core

# Recommended: Also add core vocabularies for RDF, RDFS, OWL, etc. (+5MB)
dart pub add rdf_vocabularies_core

When to Use HTTP Schema.org #

  • Legacy Compatibility: Working with existing data using HTTP URIs
  • System Requirements: Interfacing with systems that expect HTTP URIs
  • Data Migration: Transitioning from HTTP to HTTPS URIs
  • Mixed Environments: Supporting both HTTP and HTTPS in the same application

⚠️ Note: For new projects, prefer rdf_vocabularies_schema (HTTPS) as it uses the modern standard.

Usage #

For RDF Newcomers: Class-Specific Approach #

If you're new to RDF, the class-specific approach guides you to use the correct properties for each type of resource:

import 'package:rdf_core/rdf_core.dart';
import 'package:rdf_vocabularies_schema_http/schema_http.dart';
import 'package:rdf_vocabularies_core/rdf.dart';  // Optional: for RDF.type

void main() {
  final personIri = IriTerm('http://example.org/person/jane_doe');
  
  // Create a graph using Schema.org HTTP class-specific constants
  final graph = RdfGraph.fromTriples([
    // Use SchemaHttpPerson class for type-safe property access
    Triple(personIri, Rdf.type, SchemaHttpPerson.classIri),
    Triple(personIri, SchemaHttpPerson.name, LiteralTerm.string('Jane Doe')),
    Triple(personIri, SchemaHttpPerson.email, LiteralTerm.string('[email protected]')),
    Triple(personIri, SchemaHttpPerson.jobTitle, LiteralTerm.string('Software Developer')),
    Triple(personIri, SchemaHttpPerson.birthDate, LiteralTerm('1990-01-01')),
  ]);
  
  print(RdfCore.withStandardCodecs().encode(graph));

Benefits: IDE autocompletion, compile-time validation, HTTP URI compatibility.

For RDF Experts: Direct Schema.org HTTP Access #

Use Schema.org HTTP vocabulary classes directly:

import 'package:rdf_core/rdf_core.dart';
import 'package:rdf_vocabularies_schema_http/schema_http.dart';
import 'package:rdf_vocabularies_core/rdf.dart';

void main() {
  final productIri = IriTerm('http://example.org/product/123');
  
  // Create structured data with HTTP Schema.org URIs
  final graph = RdfGraph.fromTriples([
    Triple(productIri, Rdf.type, SchemaHttp.Product),
    Triple(productIri, SchemaHttp.name, LiteralTerm.string('Amazing Widget')),
    Triple(productIri, SchemaHttp.description, LiteralTerm.string('The best widget you can buy')),
    Triple(productIri, SchemaHttp.price, LiteralTerm.string('29.99')),
    Triple(productIri, SchemaHttp.priceCurrency, LiteralTerm.string('USD')),
  ]);
  
  print(RdfCore.withStandardCodecs().encode(graph));
}

Benefits: Maximum flexibility, HTTP URI compatibility, legacy system support.

Schema.org HTTP Vocabulary #

This package provides the complete Schema.org vocabulary using legacy HTTP URIs:

  • All Schema.org Types: Person, Organization, Product, Event, Place, etc.
  • All Properties: name, description, url, image, and thousands more
  • HTTP URIs: Uses http://schema.org/... (legacy format)
  • Type Safety: Class-specific constants for better development experience
  • Rich Documentation: Each term includes Schema.org descriptions

HTTP vs HTTPS Schema.org #

Schema.org is available in two URI variants:

Variant Package URIs Use Case
HTTP (this package) rdf_vocabularies_schema_http http://schema.org/Person Legacy compatibility
HTTPS (recommended) rdf_vocabularies_schema https://schema.org/Person Modern standard

Both packages contain identical Schema.org content - only the URI scheme differs.

Combining with Core Vocabularies #

For comprehensive RDF support, combine with core vocabularies:

# Add both packages for complete coverage
dart pub add rdf_vocabularies_core rdf_vocabularies_schema_http rdf_core
import 'package:rdf_vocabularies_core/foaf.dart';  // FOAF vocabulary
import 'package:rdf_vocabularies_schema_http/schema_http.dart';  // Schema.org HTTP

// Mix vocabularies as needed
final graph = RdfGraph.fromTriples([
  Triple(personIri, Rdf.type, SchemaHttp.Person),
  Triple(personIri, SchemaHttp.name, LiteralTerm.string('Jane Doe')),
  Triple(personIri, Foaf.age, LiteralTerm.integer(42)),  // FOAF property
]);

Migration to HTTPS #

When ready to migrate to HTTPS URIs, simply switch packages:

# Remove HTTP version
dart pub remove rdf_vocabularies_schema_http

# Add HTTPS version  
dart pub add rdf_vocabularies_schema

# Update imports:
# From: import 'package:rdf_vocabularies_schema_http/schema_http.dart';
# To:   import 'package:rdf_vocabularies_schema/schema.dart';

# And replace all SchemaHttp matches with Schema

Performance Characteristics #

  • Zero Runtime Overhead: Nearly all content consists of compile-time constants
  • Large but Focused: ~36MB download for complete Schema.org coverage
  • Type Safety: Catch vocabulary usage errors at compile time
  • IDE Integration: Get autocompletion and documentation directly in your editor

🀝 Contributing #

Contributions, bug reports, and feature requests are welcome!


© 2025 Klas Kalaß. Licensed under the MIT License.

0
likes
160
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

Schema.org vocabulary (HTTP variant) as Dart constants for legacy system compatibility

Homepage
Repository (GitHub)
View/report issues

Topics

#rdf #schema-org #semantic-web #vocabularies #legacy-support

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

rdf_core

More

Packages that depend on rdf_vocabularies_schema_http