locorda_rdf_terms_schema_http 0.11.0
locorda_rdf_terms_schema_http: ^0.11.0 copied to clipboard
Schema.org vocabulary (HTTP variant) as Dart constants for legacy system compatibility
locorda_rdf_terms_schema_http - Schema.org HTTP Vocabulary #
Overview #
locorda_rdf_terms_schema_http provides type-safe access to the Schema.org vocabulary with HTTP URIs as Dart constants for use with locorda_rdf_core.
This package contains the complete legacy Schema.org vocabulary (~5MB compressed) using HTTP URIs (http://schema.org/...) for compatibility with existing data and systems.
π¦ Package Selection Guide #
For an overview of all available packages and guidance on which to choose, see the Package Selection Guide in the main repository README.
π‘ Recommendation: Use
locorda_rdf_terms_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.
Related Projects #
Part of the Locorda RDF ecosystem:
- locorda/rdf-vocabularies - This repository with all vocabulary packages
- locorda/rdf - Core RDF functionality: graph classes, codecs (Turtle, JSON-LD, N-Triples, RDF/XML), vocabulary generator, and object mapping
Getting Started #
Installation #
Add the package to your project:
# Install Schema.org HTTP vocabulary (~5MB compressed)
dart pub add locorda_rdf_terms_schema_http
# Recommended: Also add essential vocabularies (FOAF, Dublin Core, etc.)
dart pub add locorda_rdf_terms_common
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
locorda_rdf_terms_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:locorda_rdf_core/core.dart';
import 'package:locorda_rdf_terms_schema_http/schema_http.dart';
import 'package:locorda_rdf_terms_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('jane.doe@example.com')),
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.
Cross-Vocabulary Properties #
Class-specific constants include commonly used properties from related vocabularies, enabling seamless vocabulary mixing:
import 'package:locorda_rdf_core/core.dart';
import 'package:locorda_rdf_terms_schema_http/schema_http.dart';
void main() {
final personIri = IriTerm('http://example.org/person/jane_doe');
// SchemaHttpPerson includes common FOAF properties - discover them via IDE autocompletion!
final graph = RdfGraph.fromTriples([
Triple(personIri, SchemaHttpPerson.rdfType, SchemaHttpPerson.classIri),
Triple(personIri, SchemaHttpPerson.name, LiteralTerm.string('Jane Doe')),
Triple(personIri, SchemaHttpPerson.email, LiteralTerm.string('jane@example.com')),
Triple(personIri, SchemaHttpPerson.foafAge, LiteralTerm.integer(42)), // FOAF property!
Triple(personIri, SchemaHttpPerson.foafKnows, otherPersonIri), // FOAF relationship!
]);
}
Benefits: Discover related properties via IDE autocompletion, natural vocabulary mixing, no need to learn all vocabularies upfront.
For RDF Experts: Direct Schema.org HTTP Access #
Use Schema.org HTTP vocabulary classes directly:
import 'package:locorda_rdf_core/core.dart';
import 'package:locorda_rdf_terms_schema_http/schema_http.dart';
import 'package:locorda_rdf_terms_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) | locorda_rdf_terms_schema_http |
http://schema.org/Person |
Legacy compatibility |
| HTTPS (recommended) | locorda_rdf_terms_schema |
https://schema.org/Person |
Modern standard |
Both packages contain identical Schema.org content - only the URI scheme differs.
Combining with Essential Vocabularies #
For comprehensive RDF support, combine with essential vocabularies:
# Add both packages for complete coverage
dart pub add locorda_rdf_terms_common locorda_rdf_terms_schema_http
import 'package:locorda_rdf_terms_common/foaf.dart'; // FOAF vocabulary
import 'package:locorda_rdf_terms_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 locorda_rdf_terms_schema_http
# Add HTTPS version
dart pub add locorda_rdf_terms_schema
# Update imports:
# From: import 'package:locorda_rdf_terms_schema_http/schema_http.dart';
# To: import 'package:locorda_rdf_terms_schema/schema.dart';
# And replace all SchemaHttp matches with Schema
Performance Characteristics #
- Zero Runtime Overhead: All vocabulary terms are compile-time constants
- Large but Focused: ~5MB compressed download for complete Schema.org coverage
- Type Safety: Catch vocabulary usage errors at compile time
- IDE Integration: Full autocompletion and inline documentation
- Tree Shaking: Unused vocabulary terms are eliminated from production builds
Custom Vocabulary Selection #
This package was generated using locorda_rdf_terms_generator. If you need a different vocabulary selection or want to include vocabularies not provided here, you can use the generator to create your own custom package tailored to your specific needs.
π€ Contributing #
Contributions, bug reports, and feature requests are welcome!
- Fork the repo and submit a PR
- See CONTRIBUTING.md for guidelines
- Join the discussion in GitHub Issues
Β© 2025-2026 Klas KalaΓ. Licensed under the MIT License.