java.lang.Object
org.apache.jena.sparql.service.enhancer.impl.ServiceOpts

public class ServiceOpts extends Object
Utilities to exploit url scheme pattern to represent key value pairs. RFC3986 only allows for a very limited set of characters:
 scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
 
For this reason '+' is used where usually '=' would be used. Separator is ':'. Examples:
 SERVICE <cache:> {} Trailing colon is needed to discriminate from relative IRIs. Resulting map: {cache=null}
 SERVICE <cache:bulk+20> {cache=null, bulk=20}
 
  • Field Details

  • Constructor Details

    • ServiceOpts

      public ServiceOpts(org.apache.jena.sparql.algebra.op.OpService opService, List<Map.Entry<String,String>> options)
  • Method Details

    • getTargetService

      public org.apache.jena.sparql.algebra.op.OpService getTargetService()
    • copy

      public ServiceOpts copy()
    • add

      public void add(String key, String value)
    • removeKey

      public void removeKey(Object key)
      Removes all occurrences of a key
    • getOptions

      public List<Map.Entry<String,String>> getOptions()
    • containsKey

      public boolean containsKey(Object key)
    • getFirstValue

      public String getFirstValue(Object key, String valueIfNull, String valueIfAbsent)
      Find a key's first value in the list of options
      Parameters:
      key - The key to find in the options
      valueIfNull - The value to return if the key is present with a null value
      valueIfAbsent - The value to return if the key is absent
    • toService

      public org.apache.jena.sparql.algebra.op.OpService toService()
      Encode the options as a OpService
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • parseAsOptions

      public static List<Map.Entry<String,String>> parseAsOptions(org.apache.jena.graph.Node node)
    • parseAsOptions

      public static List<Map.Entry<String,String>> parseAsOptions(String iri)
      Split an iri by ':' and attempt to parse the splits as key=value pairs.
    • escape

      public static String escape(String str)
    • unparse

      public static String unparse(List<Map.Entry<String,String>> optionList)
      Convert a list of options back into an escaped string
    • isKnownOption

      public static boolean isKnownOption(String key)
    • getEffectiveService

      public static ServiceOpts getEffectiveService(org.apache.jena.sparql.algebra.op.OpService opService)