// Conforms to and shex-test@2.2.0-alpha.1 export {}; // only export specified symbols (strict-export-declare-modifiers) /** * Structure for expressing a Shape Expression schema. * @see ShEx Schema definition */ export interface Schema { /** * Mandatory type "Schema". */ type: "Schema"; /** * JSON-LD @context for ShEx. */ "@context"?: "http://www.w3.org/ns/shex.jsonld" | undefined; /** * List of semantic actions to be executed when evaluating conformance. */ startActs?: SemAct[] | undefined; // + /** * Identifies default starting shape expression. */ start?: shapeExprOrRef | undefined; /** * List of ShEx schemas to import when processing this schema. */ imports?: IRIREF[] | undefined; // + /** * The list of {@link ShapeDecl}s defined in this schema. Each MUST include and {@link ShapeOr#id}. */ shapes?: ShapeDecl[] | undefined; // + } export interface semactsAndAnnotations { /** * List of semantic actions to be executed when evaluating conformance. */ semActs?: SemAct[] | undefined; // +; /** * List of {@link SemAct#predicate}/{@link SemAct#object} annotations. */ annotations?: Annotation[] | undefined; // + } /** * A declaration for a shapeExpr with added inheritance constraints. * @see ShEx ShapeDecl definition */ export interface ShapeDecl { /** * Mandatory type "ShapeDecl". */ type: "ShapeDecl"; /** * The identifier is an IRI or a BlankNode * as expressed in JSON-LD 1.1. */ id: shapeDeclLabel; /** * Whether this ShapeDecl participates in inheritance substitution. */ abstract?: BOOL | undefined; /** * The list of {@link shapeExprOrRef}s that a neighborhood MUST conform to in order to conform to this ShapeDecl. */ restricts?: shapeExprOrRef[] | undefined; // + /** * The {@link shapeExpr} to which this neighborhood MUST also conform. */ shapeExpr: shapeExpr; } /** * Union of shape expression types. * @see ShEx shapeExpr definition */ export type shapeExpr = ShapeOr | ShapeAnd | ShapeNot | NodeConstraint | Shape | ShapeExternal; /** * Union of shapeExpr and shapeDeclRef. * @see ShEx shapeExpr definition */ export type shapeExprOrRef = shapeExpr | shapeDeclRef; /** * A non-exclusive choice of shape expressions; considered conformant if any of {@link #shapeExprs} conforms. * @see ShEx shapeExpr definition */ export interface ShapeOr { /** * Mandatory type "ShapeOr". */ type: "ShapeOr"; /** * List of two or more {@link shapeExprOrRef}s in this disjunction. */ shapeExprs: shapeExprOrRef[]; // {2,} } /** * A conjunction of shape expressions; considered conformant if each conjunct conforms. * @see ShEx shapeExpr definition */ export interface ShapeAnd { /** * Mandatory type "ShapeAnd". */ type: "ShapeAnd"; /** * List of two or more {@link shapeExprOrRef}s in this conjunction. */ shapeExprs: shapeExprOrRef[]; // {2,} } /** * A negated shape expressions; considered conformant if {@link #shapeExpr} is not conformant. * @see ShEx shapeExpr definition */ export interface ShapeNot { /** * Mandatory type "ShapeNot". */ type: "ShapeNot"; /** * The {@link shapeExprOrRef} that must be non-conformant for this shape expression to be conformant. */ shapeExpr: shapeExprOrRef; } /** * A shape expression not defined in this schema or in any imported schema. The definition of this shape expression is NOT defined by ShEx. * @see ShEx shapeExpr definition */ export interface ShapeExternal { /** * Mandatory type "ShapeExternal". */ type: "ShapeExternal"; } /** * A reference a shape expression. * The reference is an IRI or a BlankNode * as expressed in JSON-LD 1.1. */ export type shapeDeclRef = shapeDeclLabel; /** * An identifier for a shape expression. * The identifier is an IRI or a BlankNode * as expressed in JSON-LD 1.1. */ export type shapeDeclLabel = IRIREF | BNODE; export type nodeKind = "iri" | "bnode" | "nonliteral" | "literal"; /** * A collection of constraints on RDF Terms expected for conformance. * The identifier is an IRI or a BlankNode * as expressed in JSON-LD 1.1. */ export interface NodeConstraint extends xsFacets, semactsAndAnnotations { /** * Mandatory type "NodeConstraint". */ type: "NodeConstraint"; /** * Type of RDF Term expected for a conformant RDF node. * @see ShEx nodeKind definition */ nodeKind?: nodeKind | undefined; /** * The RDF Literal datatype IRITerm expected for a conformant RDF node. * @see ShEx datatype definition */ datatype?: IRIREF | undefined; /** * The set of permissible values. * @see ShEx values definition */ values?: valueSetValue[] | undefined; } /** * The set of XML Schema Facets supported in ShEx; defers to {@link stringFacets} and {@link numericFacets}. * @see ShEx String Facet Constraints and ShEx Numeric Facet Constraints. */ export interface xsFacets extends stringFacets, numericFacets { } /** * The set of XML Schema Facets applying to lexical forms of RDF terms. * @see ShEx String Facet Constraints. */ export interface stringFacets { /** * Expected length of the lexical form of an RDF Term. */ length?: INTEGER | undefined; /** * Expected minimum length of the lexical form of an RDF Term. */ minlength?: INTEGER | undefined; /** * Expected maximum length of the lexical form of an RDF Term. */ maxlength?: INTEGER | undefined; /** * Regular expression which the lexical forn of an RDF Term must match. */ pattern?: STRING | undefined; /** * Optional flags for the regular expression in {@link pattern}. */ flags?: STRING | undefined; } /** * The set of XML Schema Facets applying to numeric values of RDF terms. * @see ShEx Numeric Facet Constraints. */ export interface numericFacets { /** * Conformant RDF Literal has as a numeric value <= {@link mininclusive}. */ mininclusive?: numericLiteral | undefined; /** * Conformant RDF Literal has as a numeric value < {@link minexclusive}. */ minexclusive?: numericLiteral | undefined; /** * Conformant RDF Literal has as a numeric value > {@link maxinclusive}. */ maxinclusive?: numericLiteral | undefined; /** * Conformant RDF Literal has as a numeric value >= {@link maxexclusive}. */ maxexclusive?: numericLiteral | undefined; /** * Conformant RDF Literal has as a numeric value whose canonical form has {@link totaldigits} digits. * @see ShEx totalDigits definition */ totaldigits?: INTEGER | undefined; /** * Conformant RDF Literal has as a numeric value whose canonical form has {@link fractiondigits} digits. * @see ShEx fractionDigits definition */ fractiondigits?: INTEGER | undefined; } /** * Union of numeric types in ShEx used in {@link numericFacets}s. */ export type numericLiteral = INTEGER | DECIMAL | DOUBLE; /** * Union of numeric types that may appear in a value set. * @see {@link NodeConstraint#values}. */ export type valueSetValue = | objectValue | IriStem | IriStemRange | LiteralStem | LiteralStemRange | Language | LanguageStem | LanguageStemRange; /** * JSON-LD representation of a URL or a Literal. */ export type objectValue = IRIREF | ObjectLiteral; /** * A JSON-LD Value Object used to express an RDF Literal. */ export interface ObjectLiteral { /** * The lexical form of an RDF Literal. */ value: STRING; /** * The language tag of an RDF Literal. */ language?: STRING | undefined; /** * The datatype of an RDF Literal. */ type?: STRING | undefined; } /** * Matchs an RDF IRI starting with the character sequence in {@link stem}. */ export interface IriStem { /** * Mandatory type "IriStem". */ type: "IriStem"; /** * substring of IRI to be matched. */ stem: IRIREF; } export type iriRangeStem = IRIREF | Wildcard; export type iriRangeExclusion = IRIREF | IriStem; /** * Filters a matching RDF IRIs through a list of exclusions. * The initial match is made on an IRI stem per {@link IriStem} or a {@link Wildcard} to accept any IRI. * The {@link exclusion}s are either specific IRIs or {@link IRIStem}s. */ export interface IriStemRange { /** * Mandatory type "IriStemRange". */ type: "IriStemRange"; /** * substring of IRI to be matched or a {@link Wildcard} matching any IRI. */ stem: iriRangeStem; /** * IRIs or {@link IRIStem}s to exclude. */ exclusions: iriRangeExclusion[]; // + } /** * Matchs an RDF Literal starting with the character sequence in {@link stem}. */ export interface LiteralStem { /** * Mandatory type "LiteralStem". */ type: "LiteralStem"; /** * substring of Literal to be matched. */ stem: STRING; } export type literalRangeStem = string | Wildcard; export type literalRangeExclusion = string | LiteralStem; /** * Filters a matching RDF Literals through a list of exclusions. * The initial match is made on an Literal stem per {@link LiteralStem} or a {@link Wildcard} to accept any Literal. * The {@link exclusion}s are either specific Literals or {@link LiteralStem}s. */ export interface LiteralStemRange { /** * Mandatory type "LiteralStemRange". */ type: "LiteralStemRange"; /** * substring of Literal to be matched or a {@link Wildcard} matching any Literal. */ stem: literalRangeStem; /** * Literals or {@link LiteralStem}s to exclude. */ exclusions: literalRangeExclusion[]; // + } /** * An RDF Language Tag. */ export interface Language { /** * Mandatory type "Language". */ type: "Language"; /** * The lexical representation of an RDF Language Tag. */ languageTag: LANGTAG; } /** * Matchs an RDF Language Tag starting with the character sequence in {@link stem}. */ export interface LanguageStem { /** * Mandatory type "LanguageStem". */ type: "LanguageStem"; /** * substring of Language Tag to be matched. */ stem: LANGTAG; } export type languageRangeStem = string | Wildcard; export type languageRangeExclusion = string | LanguageStem; /** * Filters a matching RDF Language Tags through a list of exclusions. * The initial match is made on an Language Tag stem per {@link Language TagStem} or a {@link Wildcard} to accept any Language Tag. * The {@link exclusion}s are either specific Language Tags or {@link Language TagStem}s. */ export interface LanguageStemRange { /** * Mandatory type "LanguageStemRange". */ type: "LanguageStemRange"; /** * substring of Language-Tag to be matched or a {@link Wildcard} matching any Language Tag. */ stem: languageRangeStem; /** * Language Tags or {@link LanguageStem}s to exclude. */ exclusions: languageRangeExclusion[]; // + } /** * An empty object signifying than any item may be matched. * This is used in {@link IriStemRange}, {@link LiteralStemRange} and {@link LanguageStemRange}. */ export interface Wildcard { /** * Mandatory type "Wildcard". */ type: "Wildcard"; } /** * A collection of {@link tripleExpr}s which must be matched by RDF Triples in conformance data. */ export interface Shape extends semactsAndAnnotations { /** * Mandatory type "Shape". */ type: "Shape"; /** * Only the predicates mentioned in the {@link expression} may appear in conformant data. */ closed?: BOOL | undefined; /** * Permit extra triples with these predicates to appear in triples which don't match any {@link TripleConstraint}s mentioned in the {@link expression}. */ extra?: IRIREF[] | undefined; /** * List of one or more {@link shapeExprOrRef}s that a neighborhood must satisfy in order to conform to this shape. */ extends?: shapeExprOrRef[]; /** * A tree of {@link tripleExpr}s specifying a set triples into or out of conformant RDF Nodes. */ expression?: tripleExprOrRef | undefined; } /** * Union of triple expression types. * @see ShEx tripleExpr definition */ export type tripleExpr = EachOf | OneOf | TripleConstraint; /** * A tripleExpr or a label to one. * @see ShEx tripleExpr definition */ export type tripleExprOrRef = tripleExpr | tripleExprRef; /** * Common attributes appearing in every form of {@link tripleExpr}. */ export interface tripleExprBase extends semactsAndAnnotations { /** * Optional identifier for {@link tripleExpr}s for reference by {@link tripleExprRef}. * The identifier is an IRI or a BlankNode * as expressed in JSON-LD 1.1. */ id?: tripleExprLabel | undefined; /** * Minimum number of times matching triples must appear in conformant data. */ min?: INTEGER | undefined; /** * Maximum number of times matching triples must appear in conformant data. */ max?: INTEGER | undefined; } /** * A list of of triple expressions; considered conformant if there is some conforming mapping of the examined triples to the {@link #tripleExprs}. * @see ShEx EachOf definition */ export interface EachOf extends tripleExprBase { /** * Mandatory type "EachOf". */ type: "EachOf"; expressions: tripleExprOrRef[]; // {2,} } /** * An exclusive choice of triple expressions; considered conformant if exactly one of {@link #shapeExprs} conforms. * @see ShEx OneOf definition */ export interface OneOf extends tripleExprBase { /** * Mandatory type "OneOf". */ type: "OneOf"; expressions: tripleExprOrRef[]; // {2,} } /** * A template matching a number of triples attached to the node being validated. */ export interface TripleConstraint extends tripleExprBase { /** * Mandatory type "TripleConstraint". */ type: "TripleConstraint"; /** * If false, the TripleConstraint matches the a triple composed of a focus node, the {@link predicate} and an object matching the (optional) {@link shapeExpr}. * If true, the TripleConstraint matches the a triple composed of a subject matching the (optional) {@link shapeExpr}, the {@link predicate} and focus node. */ inverse?: BOOL | undefined; /** * The predicate expected in a matching RDF Triple. */ predicate: IRIREF; /** * A {@link shapeExpr} matching a conformant RDF Triples subject or object, depending on the value of {@link inverse}. */ valueExpr?: shapeExprOrRef | undefined; } /** * A reference a triple expression. * The reference is an IRI or a BlankNode * as expressed in JSON-LD 1.1. */ export type tripleExprRef = tripleExprLabel; /** * An identifier for a triple expression. * The identifier is an IRI or a BlankNode * as expressed in JSON-LD 1.1. */ export type tripleExprLabel = IRIREF | BNODE; /** * An extension point for Shape Expressions allowing external code to be invoked during validation. */ export interface SemAct { /** * Mandatory type "SemAct". */ type: "SemAct"; /* * Identifier of the language for this semantic action. */ name: IRIREF; /* * The actual code to be interpreted/executed. * This may be kept separate from the ShEx containing the schema by including only {@link name}s in the schema. */ code?: STRING | undefined; } /** * An assertion about some part of a ShEx schema which has no affect on conformance checking. * These can be useful for documentation, provenance tracking, form generation, etch. */ export interface Annotation { /** * Mandatory type "Annotation". */ type: "Annotation"; /** * The RDF Predicate of the annotation. */ predicate: IRI; /** * A value for the above {@link predicate}. */ object: objectValue; } export type IRIREF = string; export type BNODE = string; export type INTEGER = number; export type STRING = string; export type DECIMAL = number; export type DOUBLE = number; export type LANGTAG = string; export type BOOL = boolean; export type IRI = string;