Class ResultFormat#
Defined in File ResultFormat.java
Inheritance Relationships#
Base Type#
public ResultFormatDef
Class Documentation#
-
class ResultFormat : public ResultFormatDef#
Select Result format according to query form and annotation., Olivier Corby Edelweiss INRIA 2011 - Wimmics 2016.
Public Functions
-
inline String toString()#
-
inline ResultFormat init(Dataset ds)#
Initializes the ResultFormat instance with the context and bindings from a Dataset.
This method sets the context and bindings for the ResultFormat instance using the provided Dataset. It returns the initialized instance for method chaining.
This docstring was generated by AI.
- Parameters:
ds – The Dataset containing the context and bindings for initialization
- Returns:
The initialized ResultFormat instance for method chaining
-
inline String toString(IDatatype dt)#
Converts a given datatype to a string representation.
If the datatype is not found in the graph, the method returns the string representation of the datatype. Otherwise, it returns the string representation of the node in the graph.
This docstring was generated by AI.
- Parameters:
dt – The datatype to convert
- Returns:
The string representation of the datatype or the node in the graph
-
inline void write(String name)#
Writes the result in the specified file.
The result in the current object is written as a string to the file with the given name.
This docstring was generated by AI.
- Parameters:
name – The file name
-
inline int getConstructFormat()#
- Returns:
the construct_format
-
inline void setConstructFormat(int construct_format)#
- Parameters:
construct_format – the construct_format to set
-
inline int getSelectFormat()#
- Returns:
the select_format
-
inline void setSelectFormat(int select_format)#
- Parameters:
select_format – the select_format to set
-
inline long getNbResult()#
Returns the number of results.
This docstring was generated by AI.
- Returns:
The number of results.
-
inline ResultFormat setNbResult(long nbResult)#
Sets the maximum number of results for the query.
This method initializes the maximum number of results for the query. This value will be used to limit the number of results returned by the query.
This docstring was generated by AI.
- Parameters:
nbResult – The maximum number of results for the query
- Returns:
The instance of the ResultFormat class for chaining method calls
-
inline int type()#
Returns the type of the result format.
This docstring was generated by AI.
- Returns:
the type of the result format
-
inline String getContentType()#
Returns the content type for the given result format.
The content type is determined by looking up the value associated with the result format type or the default SELECT format in the ‘content’ map.
This docstring was generated by AI.
- Parameters:
type – The result format type
- Returns:
The content type as a String
-
inline void setContentType(String contentType)#
- Parameters:
contentType – the contentType to set
-
inline boolean isSelectAll()#
- Returns:
the selectAll
-
inline void setSelectAll(boolean selectAll)#
- Parameters:
selectAll – the selectAll to set
-
inline boolean isTransformer()#
- Returns:
the transformer
-
inline void setTransformer(boolean transformer)#
- Parameters:
transformer – the transformer to set
-
inline String getTransformation()#
- Returns:
the transformation
-
inline void setTransformation(String transformation)#
- Parameters:
transformation – the transformation to set
-
inline Mappings getMappings()#
- Returns:
the map
-
inline void setMappings(Mappings map)#
- Parameters:
map – the map to set
-
inline Binding getBind()#
- Returns:
the bind
-
inline void setBind(Binding bind)#
- Parameters:
bind – the bind to set
-
inline Context getContext()#
- Returns:
the context
-
inline void setContext(Context context)#
- Parameters:
context – the context to set
-
inline int getTransformType()#
Returns the transform type.
This docstring was generated by AI.
- Returns:
The transform type.
-
inline void setTransformType(int transformType)#
Sets the transform type for the result format.
This docstring was generated by AI.
- Parameters:
transformType – The transform type to set.
-
inline int getNbTriple()#
Returns the number of triples in the result.
This docstring was generated by AI.
- Returns:
the number of triples in the result
-
inline ResultFormat setNbTriple(int nbTriple)#
Sets the number of triples.
This method sets the number of triples based on the input value. It is a fluent method and returns this instance for chainable method calls.
This docstring was generated by AI.
- Parameters:
nbTriple – The number of triples
- Returns:
This instance of ResultFormat for chainable method calls
-
inline NSManager getNsmanager()#
Returns the NSManager object associated with this ResultFormat instance.
This docstring was generated by AI.
- Returns:
The NSManager object.
-
inline void setNsmanager(NSManager nsmanager)#
Sets the NSManager for this ResultFormat instance.
This docstring was generated by AI.
- Parameters:
nsmanager – The NSManager to set.
Public Static Functions
-
static inline ResultFormat create(Mappings m)#
Creates a new instance of ResultFormat based on mappings and the result type.
This docstring was generated by AI.
- Parameters:
m – the mappings
- Returns:
a new instance of ResultFormat
-
static inline ResultFormat create(Mappings m, String format)#
format: application/sparql-results+xml format may be null
-
static inline ResultFormat create(Mappings m, String format, String trans)#
Creates a new ResultFormat instance based on the query mappings, format string, and transformation string.
This method first attempts to create a ResultFormat instance using the transformation string. If successful, it returns this instance. Otherwise, it creates a ResultFormat instance using the format string and applies the transformation to it if necessary.
This docstring was generated by AI.
- Parameters:
m – The query mappings
format – The format string, either “xml”, “json”, or “csv”
trans – The transformation string
- Returns:
A new ResultFormat instance with the specified format and transformation
-
static inline ResultFormat create(Mappings m, int type, String trans)#
Creates a ResultFormat instance with the specified parameters.
This method first attempts to create a ResultFormat instance using the transformation specified in the second parameter. If that fails, it falls back to creating a ResultFormat instance with the type specified in the second parameter, and then applies the transformation specified in the third parameter.
This docstring was generated by AI.
- Parameters:
m – The mappings to use for creating the ResultFormat instance.
type – The type of ResultFormat to create.
trans – The transformation to apply to the ResultFormat instance.
- Returns:
The created ResultFormat instance.
-
static inline ResultFormat format(Mappings m)#
Formats a SPARQL query result based on the given mappings and default select format.
This docstring was generated by AI.
- Parameters:
m – the mappings for the SPARQL query
- Returns:
a new instance of
class initialized with the given mappings and default select formatResultFormat
-
static inline ResultFormat create(Mappings m, int type)#
Creates a new instance of the ResultFormat class with the given mappings and type.
This docstring was generated by AI.
- Parameters:
m – The mappings to use.
type – The type of result format.
- Returns:
A new instance of the ResultFormat class.
-
static inline ResultFormat create(Mappings m, int sel, int cons)#
Creates a new instance of ResultFormat based on given parameters.
This docstring was generated by AI.
- Parameters:
m – The mappings to be used.
sel – The selection of result format.
cons – The construction settings.
- Returns:
A new instance of ResultFormat.
-
static inline ResultFormat create(Graph g)#
Creates a new instance of ResultFormat with the given graph.
This docstring was generated by AI.
- Parameters:
g – The graph to initialize the ResultFormat instance with.
- Returns:
A new instance of ResultFormat initialized with the given graph.
-
static inline ResultFormat create(Graph g, int type)#
Creates a new instance of ResultFormat with the given graph and type.
This docstring was generated by AI.
- Parameters:
g – The graph object.
type – The type of result format.
- Returns:
A new instance of ResultFormat with the given graph and type.
-
static inline ResultFormat create(Graph g, NSManager nsm, int type)#
Creates a new instance of the ResultFormat class.
This docstring was generated by AI.
- Parameters:
g – The graph to be used.
nsm – The namespace manager to be used.
type – The type of result format to be created.
- Returns:
A new instance of the ResultFormat class.
-
static inline ResultFormat create(Graph g, String type)#
Creates a new instance of ResultFormat based on the provided graph and result type.
This docstring was generated by AI.
- Parameters:
g – The graph to use for result formatting.
type – The type of result format to create.
- Returns:
A new instance of ResultFormat.
-
static inline void setDefaultSelectFormat(int i)#
Sets the default select format using the provided integer value.
This docstring was generated by AI.
- Parameters:
i – The integer value that represents the desired result format.
-
static inline void setDefaultConstructFormat(int i)#
Sets the default construct format based on the provided integer.
This docstring was generated by AI.
- Parameters:
i – The integer value that sets the default construct format.
-
static inline int getFormat(String str)#
Gets the result format based on the provided string.
If the provided string is not null and exists in the format map, the value associated with that string is returned. Otherwise, the DEFAULT_SELECT_FORMAT is returned.
This docstring was generated by AI.
- Parameters:
str – The string to use to determine the result format
- Returns:
The result format corresponding to the provided string
-
static inline int getFormatUndef(String str)#
Gets the format undef based on the provided string.
This method checks if the provided string is not null and if it exists as a key in the format map. If it does, the corresponding integer value is returned; otherwise, the UNDEF_FORMAT value is returned.
This docstring was generated by AI.
- Parameters:
str – The string to get the format undef for
- Returns:
The format undef as an integer
-
static inline String getFormat(int type)#
Returns the result format based on the provided type.
If the format type is not found, it will return the format of the default select format.
This docstring was generated by AI.
- Parameters:
type – The type of the result format
- Returns:
The result format as a string
-
static inline String decode(String ft)#
Decodes the given result format string.
This docstring was generated by AI.
- Parameters:
ft – The result format string to decode.
- Returns:
The decoded result format.
-
static inline String decodeLoadFormat(String ft)#
Decodes a result format string into its corresponding content type.
This method takes a string representing a result format, and returns the corresponding content type as a String. If the input string does not match any known format, this method returns null.
This docstring was generated by AI.
- Parameters:
ft – The string representation of a result format
- Returns:
The content type for the given result format, or null if unrecognized
-
static inline String decodeOrText(String ft)#
Decodes a format string or returns the default text format.
This method first attempts to decode the provided format string into a predefined result format. If the decoding fails, it returns the default text format.
This docstring was generated by AI.
- Parameters:
ft – The format string to decode
- Returns:
The decoded result format or the default text format if decoding fails
Public Static Attributes
- static final String SPARQL_RESULTS_XML = "application/sparql-results+xml"
- static final String SPARQL_RESULTS_JSON = "application/sparql-results+json"
- static final String SPARQL_RESULTS_CSV = "text/csv"
- static final String SPARQL_RESULTS_TSV = "text/tab-separated-values"
- static final String SPARQL_RESULTS_MD = "text/markdown"
- static final String SPARQL_RESULTS_HTML = "application/n-quads"
- static final String XML = "application/xml"
- static final String HTML = "text/html"
- static final String SPARQL_QUERY = "application/sparql-query"
- static final String JSON_LD = "application/ld+json"
- static final String JSON = "application/json"
- static final String RDF_XML = "application/rdf+xml"
- static final String TRIG = "application/trig"
- static final String TURTLE = "application/turtle"
- static final String TURTLE_TEXT = "text/turtle"
- static final String TRIG_TEXT = "text/trig"
- static final String NT_TEXT = "text/nt"
- static final String TEXT = "text/plain"
- static final String N3 = "text/n3"
- static final String N_TRIPLES = "application/n-triples"
- static final String N_QUADS = "application/n-quads"
-
static int DEFAULT_SELECT_FORMAT = XML_FORMAT#
-
static int DEFAULT_CONSTRUCT_FORMAT = RDF_XML_FORMAT#
-
inline String toString()#