Skip to content

GraphResourcePattern¤

This chapter specifies the JSON object used to provide a EasyNav Search (query) configuration. The GraphResourcePattern is part of an optional advanced configuration of the EasyNav module. It can be used to provide search filter / facets in order to tailor the search results presented to the end user.

The GraphResourcePattern object reference is provided in different ways depending on your preferences:

export type GraphResourcePattern = {
    paths: Path[];
    pathFilters?: PathVariableFilter[];
};

export type Path = {
    subjectVarName?: string;
    objectVarName?: string;
    inverted: boolean;
    predicate: string;
};

export type PathVariableFilter = {
    varname?: string;
    varIsAnyOneOfResource?: string[];
    varIsAnyOneOfLiteral?: Literal[];
    isNoneOfResource?: string[];
    isNoneOfLiteral?: Literal[];
    literalFilters?: PathVariableLiteralFilter[];
};

export type Literal = {
    value: string;
    lang?: string;
    datatype?: string;
};

export type PathVariableLiteralFilter = {
    operation:
        | "GreaterThan"
        | "LessThan"
        | "GreaterEqualsThan"
        | "LessEqualThan"
        | "NotEquals"
        | "Contains"
        | "Regex";
    value: Literal;
};
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title" : "GraphResourcePattern",
    "description" : "Description of the GraphResourcePattern JSON data structure",
    "properties": {
        "pathFilters": {
            "items": {
                "properties": {
                    "isNoneOfLiteral": {
                        "items": {
                            "properties": {
                                "datatype": {
                                    "type": "string"
                                },
                                "lang": {
                                    "type": "string"
                                },
                                "value": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "isNoneOfResource": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "literalFilters": {
                        "items": {
                            "properties": {
                                "operation": {
                                    "enum": [
                                        "Contains",
                                        "GreaterEqualsThan",
                                        "GreaterThan",
                                        "LessEqualThan",
                                        "LessThan",
                                        "NotEquals",
                                        "Regex"
                                    ],
                                    "type": "string"
                                },
                                "value": {
                                    "properties": {
                                        "datatype": {
                                            "type": "string"
                                        },
                                        "lang": {
                                            "type": "string"
                                        },
                                        "value": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "varIsAnyOneOfLiteral": {
                        "items": {
                            "properties": {
                                "datatype": {
                                    "type": "string"
                                },
                                "lang": {
                                    "type": "string"
                                },
                                "value": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "varIsAnyOneOfResource": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "varname": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "paths": {
            "items": {
                "properties": {
                    "inverted": {
                        "type": "boolean"
                    },
                    "objectVarName": {
                        "type": "string"
                    },
                    "predicate": {
                        "type": "string"
                    },
                    "subjectVarName": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        }
    },
    "type": "object"
}

The following section are a human friendly representation generated using json-schema-for-humans

Title: GraphResourcePattern

Type object
Required No
Additional properties [Not allowed]
Defined in #/definitions/GraphResourcePattern

Description: Description of the GraphResourcePattern JSON data structure

Property Pattern Type Deprecated Definition Title/Description
- pathFilters No array No - -
+ paths No array No - -

pathFilters¤

Type array
Required No
Array restrictions
Min items N/A
Max items N/A
Items unicity False
Additional items False
Tuple validation See below
Each item of this array must be Description
PathVariableFilter -

PathVariableFilter¤

Type object
Required No
Additional properties [Not allowed]
Defined in #/definitions/PathVariableFilter
Property Pattern Type Deprecated Definition Title/Description
- isNoneOfLiteral No array No - -
- isNoneOfResource No array of string No - -
- literalFilters No array No - -
- varIsAnyOneOfLiteral No array No - -
- varIsAnyOneOfResource No array of string No - -
- varname No string No - -

isNoneOfLiteral¤

Type array
Required No
Array restrictions
Min items N/A
Max items N/A
Items unicity False
Additional items False
Tuple validation See below
Each item of this array must be Description
Literal -
Literal¤
Type object
Required No
Additional properties [Not allowed]
Defined in #/definitions/Literal
Property Pattern Type Deprecated Definition Title/Description
- datatype No string No - -
- lang No string No - -
+ value No string No - -
datatype¤
Type string
Required No
lang¤
Type string
Required No
value¤
Type string
Required Yes

isNoneOfResource¤

Type array of string
Required No
Array restrictions
Min items N/A
Max items N/A
Items unicity False
Additional items False
Tuple validation See below
Each item of this array must be Description
isNoneOfResource items -
isNoneOfResource items¤
Type string
Required No

literalFilters¤

Type array
Required No
Array restrictions
Min items N/A
Max items N/A
Items unicity False
Additional items False
Tuple validation See below
Each item of this array must be Description
PathVariableLiteralFilter -
PathVariableLiteralFilter¤
Type object
Required No
Additional properties [Not allowed]
Defined in #/definitions/PathVariableLiteralFilter
Property Pattern Type Deprecated Definition Title/Description
+ operation No enum (of string) No - -
+ value No object No Same as pathFilters_items_isNoneOfLiteral_items -
operation¤
Type enum (of string)
Required Yes

Must be one of:

  • “GreaterThan”
  • “LessThan”
  • “GreaterEqualsThan”
  • “LessEqualThan”
  • “NotEquals”
  • “Contains”
  • “Regex”
value¤
Type object
Required Yes
Additional properties [Not allowed]
Same definition as pathFilters_items_isNoneOfLiteral_items

varIsAnyOneOfLiteral¤

Type array
Required No
Array restrictions
Min items N/A
Max items N/A
Items unicity False
Additional items False
Tuple validation See below
Each item of this array must be Description
Literal -
Literal¤
Type object
Required No
Additional properties [Not allowed]
Same definition as pathFilters_items_isNoneOfLiteral_items

varIsAnyOneOfResource¤

Type array of string
Required No
Array restrictions
Min items N/A
Max items N/A
Items unicity False
Additional items False
Tuple validation See below
Each item of this array must be Description
varIsAnyOneOfResource items -
varIsAnyOneOfResource items¤
Type string
Required No

varname¤

Type string
Required No

paths¤

Type array
Required Yes
Array restrictions
Min items N/A
Max items N/A
Items unicity False
Additional items False
Tuple validation See below
Each item of this array must be Description
Path -

Path¤

Type object
Required No
Additional properties [Not allowed]
Defined in #/definitions/Path
Property Pattern Type Deprecated Definition Title/Description
+ inverted No boolean No - -
- objectVarName No string No - -
+ predicate No string No - -
- subjectVarName No string No - -

inverted¤

Type boolean
Required Yes

objectVarName¤

Type string
Required No

predicate¤

Type string
Required Yes

subjectVarName¤

Type string
Required No

Generated using json-schema-for-humans on 2022-11-10 at 21:15:54 +0100

An concrete example object is shown here:

{
    "paths": [
        {
            "subjectVarName": "subResource",
            "objectVarName": "resource",
            "predicate": "http://example.com/vocab/hasParent"
        },
        {
            "subjectVarName": "resource",
            "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
            "objectVarName": "class"
        }
    ],
    "pathFilters": [
        {
            "varname": "class",
            "varIsAnyOneOfResource": [
                "http://example.com/vocab/Company"
            ]
        }
    ]
}

A valid configuration must use a subjectVarName called resource. This is the binding that yields results.

This configuration produces the following result, it only shows results where:

  • resource is of type http://example.com/vocab/Company
  • a subResource exists which is related to resource via the http://example.com/vocab/hasParent property

Comments