LValue

LValue

new LValue(valueopt, parseopt, sort_namesopt)

Description:
  • Implements a minimal C/C++ ontology view of a JSON data structure.

    Extends: Value. This class extends Value, with all public methods available.

    • Such a LValue has the capability to interface with a ontology reasoner and other tools.
    • Value functions, beyond Value functions
      (open in new tab)
Parameters:
Name Type Attributes Default Description
value string | bool | int | uint | double | float | JSON <optional>

The initial value.

parse bool <optional>
false

For a string value, if true parses the string using the Turtoise semantic.

sort_names bool <optional>
false

For a parsed string value, if true sorts the names in alphabetic order, as performed by Value::sortNames().

Methods

getTurtoise()

Description:
  • Outputs the data structure as a serialized Turtoise set of triplets.

    • The standard OWL prefixes are predefined:
    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
    @prefix xml: <http://www.w3.org/XML/1998/namespace> .
    
Returns:

The data structure content using N-Triples syntax.

setTurtoise(stringopt) → {Value}

Description:
  • Appends a data structure serialized as a Turtoise set of triplets.

Parameters:
Name Type Attributes Description
string String <optional>

The input triples using the N-Triples syntax.

Returns:

This value, allowing to chain set methods.

Type
Value

deduce(valueopt, wjsonopt)

Description:
  • Runs an external reasoner to obtain deduced features.

    • It is not available in the cygwin environment.
    • The present implementation interfaces with Protege using the run_protege.sh with
      • /tmp/run_protege.input.n3 as input,
      • /tmp/run_protege.input.n3.inferred.owl.n3 as output,
      • /tmp/run_protege.log with the complete process log.
Parameters:
Name Type Attributes Default Description
value Value <optional>

A Value* pointer output value, by default append deduced features to this value.

wjson string <optional>
"./src"

The wjson current source files directory to access to the required scripts.

(static) readTriples(string) → {Value}

Description:
  • Reads a string and return the best parsed structure.

    • Implements a N-Triples weak parser.
      • The triple IRI of the form <IRI> are unquoted (suppression of the < and >) and interal > is unescaped.
      • The triple string of the form "string" are unquoted (suppression of the ") and internal " is unescaped.
      • The IRI of the form local: are unescaped (suppression of the local: prefix).
Parameters:
Name Type Description
string string

The input string to parse.

Returns:

A [[subject predicate object] …] array with the triplets.

Type
Value