- What is sweetrdf/rdf-interface used for in PHP and Laravel?
- It defines PHP interfaces for the common layers of an RDF stack: terms, datasets, parsers, serializers, and SPARQL clients. In Laravel, you can use it to compose interchangeable RDF components instead of adopting one monolithic library. You still install and bind concrete implementations such as quickRdf or quickRdfIo in your application.
- How do I install sweetrdf/rdf-interface in a Laravel project?
- Install it with Composer using composer require sweetrdf/rdf-interface. The package provides interfaces only, so you will usually also install a reference implementation such as sweetrdf/quickRdf for terms and datasets or sweetrdf/quickRdfIo for parsers and serializers. In Laravel, bind those concrete classes to the rdfInterface contracts in a service provider.
- Is sweetrdf/rdf-interface compatible with Laravel 10, 11, or 12?
- The package is framework-agnostic and has no Laravel-specific version constraint. It can be used with Laravel 10, 11, or 12 as long as your PHP version satisfies the package Composer requirements. Check the composer.json PHP constraint before upgrading Laravel or PHP.
- Do I need a service provider or config file for sweetrdf/rdf-interface?
- No. sweetrdf/rdf-interface is an interfaces-only package , so it does not ship a Laravel service provider, facade, or config file. You create your own bindings or a small service provider when you want Laravel's container to inject concrete RDF implementations.
- How does sweetrdf/rdf-interface differ from EasyRdf?
- EasyRdf is a monolithic RDF library, while sweetrdf/rdf-interface splits the stack into contracts for terms, datasets, parsers, serializers, and SPARQL clients. That makes it easier to swap components, but the API can feel unfamiliar to EasyRdf users. The rdfInterface2easyRdf adapter and the EasyRdf migration document help bridge both directions.
- Can I use sweetrdf/rdf-interface to parse and serialize Turtle or N-Quads?
- The interfaces themselves do not parse or serialize RDF; they define the contracts that parsers and serializers implement. For Turtle, NTriples, NQuads, and NTriplesStar support, use the sweetrdf/quickRdfIo package. You can then inject those parser and serializer implementations into your Laravel services.
- How do I test that my RDF implementation complies with rdfInterface?
- Use the sweetrdf/rdfInterfaceTests compliance suite to validate your custom implementation against the contracts. Run the tests in your package's CI pipeline alongside your own unit tests. The quickRdf and simpleRdf reference implementations are useful examples of compliant behavior.
- Does sweetrdf/rdf-interface support RDF-star or RDF 1.1?
- The Quad contract is intentionally relaxed and allows any Term as subject or object, which future-proofs the design for RDF-star and similar extensions. NTriplesStar parsing and serialization are available through quickRdfIo. For core RDF 1.1 terms and datasets, the reference implementations follow the rdfInterface contracts.
- What are the performance and production concerns with sweetrdf/rdf-interface?
- Stream-based PSR-7 I/O is efficient for large RDF files but adds complexity for small in-memory operations, so cache parsed or serialized results where it matters. Immutable terms and quads improve safety and static analysis but can increase object creation and memory use when modifying datasets frequently. The adopter community is small and the SPARQL client is early-stage, so rely on compliance tests and plan for internal maintenance of critical integrations.
- How do I use sweetrdf/rdf-interface with Laravel filesystem, database, or cache?
- Use PSR-7 streams with Laravel's filesystem or HTTP client for RDF file import and export, and store quads in relational columns or a NoSQL index when you need persistence. Immutable terms are serializable, so caching parsed datasets or terms in Redis can reduce repeated work. For SPARQL endpoints, pair the interfaces with a client implementation and keep early-stage client limitations in mind.