API Docs for: 0.6.0
Show:

sgvizler.parser Class

Defined in: src/parser.js:2

Parses a SPARQL result set, assumed to be in either W3C's XML or JSON format, into Google JSON which is the JSON format that the google.visualization.DataTable class accepts.

Variable notation: xtable, xcol(s), xrow(s) -- x is 's'(parql) or 'g'(oogle).

Dependencies: - sgvizler.namespace - jQuery - for xml "browsing".

Methods

convertJSON

(
  • stable
)
Object protected

Defined in src/parser.js:186

Available since 0.1

Converts a SPARQL JSON result set into "Google JSON", see https://developers.google.com/chart/interactive/docs/reference#DataTable.

Parameters:

  • stable Object

    The SPARQL JSON result set.

Returns:

Object:

Object literal ready for google.visualization.DataTable consumption.

convertXML

(
  • sxml
)
Object protected

Defined in src/parser.js:122

Available since 0.2.2

Converts a SPARQL XML result set into "Google JSON", see https://developers.google.com/chart/interactive/docs/reference#DataTable.

Parameters:

  • sxml Object

    The SPARQL XML result set.

Returns:

Object:

Object literal ready for google.visualization.DataTable consumption.

countJSON

(
  • stable
)
Number protected

Defined in src/parser.js:254

Available since 0.1

Returns number of results, SPARQL JSON.

Parameters:

  • stable Object

    The SPARQL JSON result set.

Returns:

Number:

The number of result set rows.

countXML

(
  • sxml
)
Number protected

Defined in src/parser.js:242

Available since 0.2.2

Returns number of results, SPARQL XML.

Parameters:

  • sxml Object

    The SPARQL XML result set.

Returns:

Number:

The number of result set rows.

getGoogleJsonDatatype

(
  • sdatatype
)
String private

Defined in src/parser.js:56

Available since 0.1

Converts XSD datatypes into Google JSON datatypes.

See also property datatypeXSD2JS.

Parameters:

  • sdatatype String

    An XSD datatype, full URL.

Returns:

String:

gdatatype, defaults to string

getGoogleJsonValue

(
  • value
  • gdatatype
  • stype
)
Date | Number | String private

Defined in src/parser.js:70

Available since 0.1

according to the Google JSON datatype, i.e., values other than strings and booleans need special treatment. If the value is an URL, we "prefixify" it.

See also sgvizler.namespace.prefixify

Parameters:

  • value String | Number | Boolean

    The value from the SPARQL result set.

  • gdatatype String

    The Google JSON datatype.

  • stype String

    The type of the value in the SPARQL endpoint, e.g. uri or literal.

Returns:

Date | Number | String:

The converted value.

Properties

datatypeXSD2JS

Object private

Defined in src/parser.js:29

Available since 0.1

Convertion table for turning XSD datatypes into the "javascript" datatypes which the google.visualization.DataTable accepts, which is: string, number, boolean, date, datetime, timeofday.