Namespace Server
The Server module handles networking for the HTTP services offered by the store.
These services are defined in different modules and loaded here on demand.
Defined in: server.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
Server.defaultOptions
Configuration options for the store's server and default values
|
<static> |
Server.optionSwitches
Command line switches for the store's server configuration options
|
<static> |
Server.store
RDFStore-JS instance used by this server
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Server.buildResponseBindings(mediaTypes, bindings, res)
Builds an SPARQL HTTP protocol response for a collection of bindings
returned by the RDF store
|
<static> |
Server.buildResponseBoolean(mediaTypes, boolValue, res)
Builds an SPARQL HTTP protocol response for a boolean value
returned by the RDF store
|
<static> |
Server.buildResponseGraph(mediaTypes, graph, res)
Builds an SPARQL HTTP protocol response for RDF JS interface graph
returned by the RDF store
|
<static> |
Server.graphToJSONLD(graph, rdf)
Transforms a RDF JS Interfaces API Graph object into a JSON-LD serialization
|
<static> |
Server.jsonldCoerce(obj, prpoerty, type)
Adds a coercion annotation to a json-ld object
|
<static> |
Server.mediaTypes(request)
Parses the 'Accept' HTTP header and returns an array of media types
|
<static> |
Server.parseCommand()
Parses the command passed to the server
|
<static> |
Server.parseOptions()
Merge command line configuration with the default server options
|
<static> |
Server.printUsage()
Prints the 'usage' message of the server
|
<static> |
Server.routeRequest(options)
Returns a function that route HTTP requests according to the configuration
options passed as arguments
|
<static> |
Server.SPARQLProtocolHandler(req, res, data)
Handler function that executes a SPARQL query and build a response according
to the SPARQL HTTP Protocol
|
<static> |
Server.start()
Starts the server, parsing the options and handling requests
using the right handler function.
|
<static> |
Server.startStore(options, callback)
Creates the connection to the RDF store according to the configuration
passed as parameters to the server.
|
<static> |
Server.withCORSHeader(status, headers)
Add HTTP beaders required for CORS requests
|
<static> |
Server.xmlEncode(data)
Escapes XML chars
|
Field Detail
<static>
Server.defaultOptions
Configuration options for the store's server and default values
<static>
Server.optionSwitches
Command line switches for the store's server configuration options
<static>
Server.store
RDFStore-JS instance used by this server
Method Detail
<static>
Server.buildResponseBindings(mediaTypes, bindings, res)
Builds an SPARQL HTTP protocol response for a collection of bindings
returned by the RDF store
- Parameters:
- mediaTypes
- bindings
- res
<static>
Server.buildResponseBoolean(mediaTypes, boolValue, res)
Builds an SPARQL HTTP protocol response for a boolean value
returned by the RDF store
- Parameters:
- mediaTypes
- boolValue
- res
<static>
Server.buildResponseGraph(mediaTypes, graph, res)
Builds an SPARQL HTTP protocol response for RDF JS interface graph
returned by the RDF store
- Parameters:
- mediaTypes
- graph
- res
<static>
Server.graphToJSONLD(graph, rdf)
Transforms a RDF JS Interfaces API Graph object into a JSON-LD serialization
- Parameters:
- graph
- JS RDF Interface graph object to be serialized
- rdf
- JS RDF Interface RDF environment object
<static>
Server.jsonldCoerce(obj, prpoerty, type)
Adds a coercion annotation to a json-ld object
- Parameters:
- obj
- jsonld Object where the coerced property will be added
- prpoerty
- URI of the property to be coerced
- type
- coercion type
<static>
Server.mediaTypes(request)
Parses the 'Accept' HTTP header and returns an array of media types
- Parameters:
- request
<static>
Server.parseCommand()
Parses the command passed to the server
<static>
Server.parseOptions()
Merge command line configuration with the default server options
<static>
Server.printUsage()
Prints the 'usage' message of the server
<static>
Server.routeRequest(options)
Returns a function that route HTTP requests according to the configuration
options passed as arguments
- Parameters:
- {Object} options
- map of configuration options with parameters passed to the server.
<static>
Server.SPARQLProtocolHandler(req, res, data)
Handler function that executes a SPARQL query and build a response according
to the SPARQL HTTP Protocol
- Parameters:
- req
- Node.JS request object
- res
- Node.JS response object
- data
- textual data send the in the HTTP request
<static>
Server.start()
Starts the server, parsing the options and handling requests
using the right handler function.
<static>
Server.startStore(options, callback)
Creates the connection to the RDF store according to the configuration
passed as parameters to the server.
The store instance created can be accessed at the property
Server.store
- Parameters:
- options
- callback
<static>
Server.withCORSHeader(status, headers)
Add HTTP beaders required for CORS requests
- Parameters:
- status
- headers
<static>
Server.xmlEncode(data)
Escapes XML chars
- Parameters:
- data