-
Notifications
You must be signed in to change notification settings - Fork 0
DeveloperGuide SPARQL Operators
Home > Developer Guide > SPARQL Engine > SPARQL Operators
SPARQL Operators are an extension to SPARQL permitted by the specification which allow for implementations to extend the definition of certain operators - namely =, !=, <, <=, >, >=, +, -, * and /.
Currently dotNetRDF only supports extending the arithmetic operators i.e. +, -, * and /. In the future we will likely extend this functionality to allow any operator to be overloaded.
Right now the only operators which dotNetRDF provides extensions for are + and - when used with xsd:dateTime, xsd:duration, xsd:dayTimeDuration. This means that when using our SPARQL engine you can add/subtract durations from date times and add/subtract durations from each other.
Custom operators are implemented by implementing the VDS.RDF.Query.Operators.ISparqlOperator interface and registering your implementation with the VDS.RDF.Query.Operators.SparqlOperators registry.
The ISparqlOperator interface is relatively simple containing a single property and two methods. Once this is implemented you register your implementation like so:
SparqlOperators.AddOperator(new MyCustomOperator());The Operator property returns a VDS.RDF.Query.Operators.SparqlOperatorType which indicates which operator your implementation overloads.
The IsApplicable() method takes in the proposed arguments for the operator and determines whether the operator can be applied to those arguments e.g. are the argument types compatible for the implementation.
The Apply() method takes the arguments for the operator and applies the operator returning either the resulting value or throwing a VDS.RDF.Query.RdfQueryException if an error occurs.
- Getting Started
- Library Overview
- Hello World
- Reading RDF
- Writing RDF
- Working With Graphs
- Typed Values and Lists
- Working with Triple Stores
- Building SPARQL
- Querying with SPARQL
- Updating with SPARQL
- Exceptions
- Equality and Comparison
- Event Model
- Utility Methods
- Extension Methods
- Using the Namespace Mapper
- Storage API
- Advanced SPARQL
- Ontology API
- Inference and Reasoning
- ASP.NET Integration
- Global Options
- Formatting API
-
Configuration API
- Graphs
- Triple Stores
- Object Factories
- Readers and Writers
- SPARQL Endpoints
- Query Processors
- Update Processors
- Protocol Processors
- SPARQL Datasets
- SPARQL Expression Factories
- SPARQL Operators
- SPARQL Optimisers
- Full Text Query
- Reasoners
- Storage Providers
- User Groups
- Permissions
- Users
- Static Options
- Proxy Servers
- Handlers API
- JSON-LD API
- Tools