Class SerializerRegistry

java.lang.Object
org.apache.jena.sparql.serializer.SerializerRegistry

public class SerializerRegistry extends Object
Provides a registry of serializers for queries and updates

By registering custom QuerySerializerFactory or UpdateSerializerFactory instances the mapping of a syntax to a serialization can be customised and this allows the serialization of queries and updates to be customised if desired.

This feature is primarily intended for system programmers as changing how queries and updates are serialized could have knock on effects particularly if you use ARQ to interact with remote systems. The default registered serializers produce standards compliant SPARQL syntax and should be more than sufficient in most cases

  • Method Details

    • get

      public static SerializerRegistry get()
      Gets the serializer registry which is a singleton lazily instantiating it if this is the first time this method has been called
      Returns:
      Registry
    • addQuerySerializer

      public void addQuerySerializer(Syntax syntax, QuerySerializerFactory factory)
      Adds a query serializer factory for the given syntax
      Parameters:
      syntax - Syntax
      factory - Serializer factory
      Throws:
      IllegalArgumentException - Thrown if the given factory does not accept the given syntax
    • addUpdateSerializer

      public void addUpdateSerializer(Syntax syntax, UpdateSerializerFactory factory)
      Adds an update serializer factory for the given syntax
      Parameters:
      syntax - Syntax
      factory - Serializer factory
      Throws:
      IllegalArgumentException - Thrown if the given factory does not accept the given syntax
    • containsQuerySerializer

      public boolean containsQuerySerializer(Syntax syntax)
      Gets whether a query serializer factory is registered for the given syntax
      Parameters:
      syntax - Syntax
      Returns:
      True if registered, false otherwise
    • containsUpdateSerializer

      public boolean containsUpdateSerializer(Syntax syntax)
      Gets whether an update serializer factory is registered for the given syntax
      Parameters:
      syntax - Syntax
      Returns:
      True if registered, false otherwise
    • getQuerySerializerFactory

      public QuerySerializerFactory getQuerySerializerFactory(Syntax syntax)
      Gets the query serializer factory for the given syntax which may be null if there is none registered
      Parameters:
      syntax - Syntax
      Returns:
      Query Serializer Factory or null if none registered for the given syntax
    • getUpdateSerializerFactory

      public UpdateSerializerFactory getUpdateSerializerFactory(Syntax syntax)
      Gets the update serializer factory for the given syntax which may be null if there is none registered
      Parameters:
      syntax - Syntax
      Returns:
      Update Serializer Factory or null if none registered for the given syntax
    • removeQuerySerializer

      public void removeQuerySerializer(Syntax syntax)
      Removes the query serializer factory for the given syntax
      Parameters:
      syntax - Syntax
    • removeUpdateSerializer

      public void removeUpdateSerializer(Syntax syntax)
      Removes the update serializer factory for the given syntax
      Parameters:
      syntax - Syntax