operators
This contains evaluation functions for expressions
They get bound as instances-methods to the CompValue objects from parserutils using setEvalFn
Functions:
-
AdditiveExpression– -
Builtin_ABS–http://www.w3.org/TR/sparql11-query/#func-abs
-
Builtin_BNODE–http://www.w3.org/TR/sparql11-query/#func-bnode
-
Builtin_BOUND–http://www.w3.org/TR/sparql11-query/#func-bound
-
Builtin_CEIL–http://www.w3.org/TR/sparql11-query/#func-ceil
-
Builtin_COALESCE–http://www.w3.org/TR/sparql11-query/#func-coalesce
-
Builtin_CONCAT–http://www.w3.org/TR/sparql11-query/#func-concat
-
Builtin_CONTAINS–http://www.w3.org/TR/sparql11-query/#func-strcontains
-
Builtin_DATATYPE– -
Builtin_DAY– -
Builtin_ENCODE_FOR_URI– -
Builtin_EXISTS– -
Builtin_FLOOR–http://www.w3.org/TR/sparql11-query/#func-floor
-
Builtin_HOURS– -
Builtin_IF–http://www.w3.org/TR/sparql11-query/#func-if
-
Builtin_IRI–http://www.w3.org/TR/sparql11-query/#func-iri
-
Builtin_LANG–http://www.w3.org/TR/sparql11-query/#func-lang
-
Builtin_LANGMATCHES–http://www.w3.org/TR/sparql11-query/#func-langMatches
-
Builtin_LCASE– -
Builtin_MD5– -
Builtin_MINUTES– -
Builtin_MONTH– -
Builtin_NOW–http://www.w3.org/TR/sparql11-query/#func-now
-
Builtin_RAND–http://www.w3.org/TR/sparql11-query/#idp2133952
-
Builtin_REGEX–http://www.w3.org/TR/sparql11-query/#func-regex
-
Builtin_REPLACE–http://www.w3.org/TR/sparql11-query/#func-substr
-
Builtin_ROUND–http://www.w3.org/TR/sparql11-query/#func-round
-
Builtin_SECONDS–http://www.w3.org/TR/sparql11-query/#func-seconds
-
Builtin_SHA1– -
Builtin_SHA256– -
Builtin_SHA384– -
Builtin_SHA512– -
Builtin_STR– -
Builtin_STRAFTER–http://www.w3.org/TR/sparql11-query/#func-strafter
-
Builtin_STRBEFORE–http://www.w3.org/TR/sparql11-query/#func-strbefore
-
Builtin_STRDT–http://www.w3.org/TR/sparql11-query/#func-strdt
-
Builtin_STRENDS–http://www.w3.org/TR/sparql11-query/#func-strends
-
Builtin_STRLANG–http://www.w3.org/TR/sparql11-query/#func-strlang
-
Builtin_STRLEN– -
Builtin_STRSTARTS–http://www.w3.org/TR/sparql11-query/#func-strstarts
-
Builtin_STRUUID–http://www.w3.org/TR/sparql11-query/#func-strdt
-
Builtin_SUBSTR–http://www.w3.org/TR/sparql11-query/#func-substr
-
Builtin_TIMEZONE–http://www.w3.org/TR/sparql11-query/#func-timezone
-
Builtin_TZ– -
Builtin_UCASE– -
Builtin_UUID–http://www.w3.org/TR/sparql11-query/#func-strdt
-
Builtin_YEAR– -
Builtin_isBLANK– -
Builtin_isIRI– -
Builtin_isLITERAL– -
Builtin_isNUMERIC– -
Builtin_sameTerm– -
ConditionalAndExpression– -
ConditionalOrExpression– -
EBV–Effective Boolean Value (EBV)
-
Function–Custom functions and casts
-
MultiplicativeExpression– -
RelationalExpression– -
UnaryMinus– -
UnaryNot– -
UnaryPlus– -
and_– -
calculateDuration–returns the duration Literal between two datetime
-
calculateFinalDateTime–Calculates the final dateTime/date/time resultant after addition/
-
custom_function–Decorator version of :func:
register_custom_function. -
date– -
dateTimeObjects–return a dataTime/date/time/duration/dayTimeDuration/yearMonthDuration python objects from a literal
-
datetime– -
default_cast– -
isCompatibleDateTimeDatatype–Returns a boolean indicating if first object is compatible
-
literal– -
not_– -
numeric–return a number from a literal
-
register_custom_function–Register a custom SPARQL function.
-
simplify– -
string–Make sure the passed thing is a string literal
-
unregister_custom_function–The ‘func’ argument is included for compatibility with existing code.
Attributes:
AdditiveExpression
AdditiveExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Literal
Source code in rdflib/plugins/sparql/operators.py
Builtin_ABS
Builtin_BNODE
Builtin_BNODE(expr, ctx) -> BNode
http://www.w3.org/TR/sparql11-query/#func-bnode
Source code in rdflib/plugins/sparql/operators.py
Builtin_BOUND
http://www.w3.org/TR/sparql11-query/#func-bound
Builtin_CEIL
http://www.w3.org/TR/sparql11-query/#func-ceil
Builtin_COALESCE
Builtin_COALESCE(expr: Expr, ctx)
http://www.w3.org/TR/sparql11-query/#func-coalesce
Source code in rdflib/plugins/sparql/operators.py
Builtin_CONCAT
http://www.w3.org/TR/sparql11-query/#func-concat
Source code in rdflib/plugins/sparql/operators.py
Builtin_CONTAINS
http://www.w3.org/TR/sparql11-query/#func-strcontains
Builtin_DATATYPE
Builtin_DATATYPE(e: Expr, ctx) -> Optional[str]
Source code in rdflib/plugins/sparql/operators.py
Builtin_DAY
Builtin_ENCODE_FOR_URI
Builtin_EXISTS
Builtin_EXISTS(e: Expr, ctx: FrozenBindings) -> Literal
Source code in rdflib/plugins/sparql/operators.py
Builtin_FLOOR
http://www.w3.org/TR/sparql11-query/#func-floor
Builtin_HOURS
Builtin_IF
Builtin_IF(expr: Expr, ctx)
Builtin_IRI
Builtin_IRI(expr: Expr, ctx: FrozenBindings) -> URIRef
http://www.w3.org/TR/sparql11-query/#func-iri
Source code in rdflib/plugins/sparql/operators.py
Builtin_LANG
http://www.w3.org/TR/sparql11-query/#func-lang
Returns the language tag of ltrl, if it has one. It returns “” if ltrl has no language tag. Note that the RDF data model does not include literals with an empty language tag.
Source code in rdflib/plugins/sparql/operators.py
Builtin_LANGMATCHES
http://www.w3.org/TR/sparql11-query/#func-langMatches
Source code in rdflib/plugins/sparql/operators.py
Builtin_LCASE
Builtin_MD5
Builtin_MINUTES
Builtin_MONTH
Builtin_NOW
Builtin_RAND
Builtin_REGEX
http://www.w3.org/TR/sparql11-query/#func-regex Invokes the XPath fn:matches function to match text against a regular expression pattern. The regular expression language is defined in XQuery 1.0 and XPath 2.0 Functions and Operators section 7.6.1 Regular Expression Syntax
Source code in rdflib/plugins/sparql/operators.py
Builtin_REPLACE
http://www.w3.org/TR/sparql11-query/#func-substr
Source code in rdflib/plugins/sparql/operators.py
Builtin_ROUND
http://www.w3.org/TR/sparql11-query/#func-round
Source code in rdflib/plugins/sparql/operators.py
Builtin_SECONDS
http://www.w3.org/TR/sparql11-query/#func-seconds
Source code in rdflib/plugins/sparql/operators.py
Builtin_SHA1
Builtin_SHA256
Builtin_SHA384
Builtin_SHA512
Builtin_STR
Builtin_STRAFTER
http://www.w3.org/TR/sparql11-query/#func-strafter
Source code in rdflib/plugins/sparql/operators.py
Builtin_STRBEFORE
http://www.w3.org/TR/sparql11-query/#func-strbefore
Source code in rdflib/plugins/sparql/operators.py
Builtin_STRDT
Builtin_STRENDS
http://www.w3.org/TR/sparql11-query/#func-strends
Builtin_STRLANG
http://www.w3.org/TR/sparql11-query/#func-strlang
Source code in rdflib/plugins/sparql/operators.py
Builtin_STRLEN
Builtin_STRSTARTS
http://www.w3.org/TR/sparql11-query/#func-strstarts
Builtin_STRUUID
Builtin_STRUUID(expr, ctx) -> Literal
Builtin_SUBSTR
http://www.w3.org/TR/sparql11-query/#func-substr
Source code in rdflib/plugins/sparql/operators.py
Builtin_TIMEZONE
http://www.w3.org/TR/sparql11-query/#func-timezone
Returns:
-
Literal–The timezone part of arg as an xsd:dayTimeDuration.
Source code in rdflib/plugins/sparql/operators.py
Builtin_TZ
Source code in rdflib/plugins/sparql/operators.py
Builtin_UCASE
Builtin_UUID
Builtin_YEAR
Builtin_isBLANK
Builtin_isBLANK(expr: Expr, ctx: FrozenBindings) -> Literal
Builtin_isIRI
Builtin_isIRI(expr, ctx) -> Literal
Builtin_isLITERAL
Builtin_isLITERAL(expr, ctx) -> Literal
Builtin_isNUMERIC
Builtin_isNUMERIC(expr, ctx) -> Literal
Builtin_sameTerm
ConditionalAndExpression
ConditionalAndExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Literal
Source code in rdflib/plugins/sparql/operators.py
ConditionalOrExpression
ConditionalOrExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Literal
Source code in rdflib/plugins/sparql/operators.py
EBV
EBV(rt: Literal) -> bool
EBV(rt: Union[Variable, IdentifiedNode, SPARQLError, Expr]) -> NoReturn
EBV(rt: Union[Identifier, SPARQLError, Expr]) -> Union[bool, NoReturn]
EBV(rt: Union[Identifier, SPARQLError, Expr]) -> bool
Effective Boolean Value (EBV)
- If the argument is a typed literal with a datatype of xsd:boolean, the EBV is the value of that argument.
- If the argument is a plain literal or a typed literal with a datatype of xsd:string, the EBV is false if the operand value has zero length; otherwise the EBV is true.
- If the argument is a numeric type or a typed literal with a datatype derived from a numeric type, the EBV is false if the operand value is NaN or is numerically equal to zero; otherwise the EBV is true.
- All other arguments, including unbound arguments, produce a type error.
Source code in rdflib/plugins/sparql/operators.py
Function
Function(e: Expr, ctx: FrozenBindings) -> Node
Custom functions and casts
Source code in rdflib/plugins/sparql/operators.py
MultiplicativeExpression
MultiplicativeExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Literal
Source code in rdflib/plugins/sparql/operators.py
RelationalExpression
RelationalExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Literal
Source code in rdflib/plugins/sparql/operators.py
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | |
UnaryMinus
UnaryMinus(expr: Expr, ctx: FrozenBindings) -> Literal
UnaryNot
UnaryNot(expr: Expr, ctx: FrozenBindings) -> Literal
UnaryPlus
UnaryPlus(expr: Expr, ctx: FrozenBindings) -> Literal
and_
calculateDuration
calculateDuration(obj1: Union[date, datetime], obj2: Union[date, datetime]) -> Literal
returns the duration Literal between two datetime
Source code in rdflib/plugins/sparql/operators.py
calculateFinalDateTime
calculateFinalDateTime(obj1: Union[date, datetime], dt1: URIRef, obj2: Union[Duration, timedelta], dt2: URIRef, operation: str) -> Literal
Calculates the final dateTime/date/time resultant after addition/ subtraction of duration/dayTimeDuration/yearMonthDuration
Source code in rdflib/plugins/sparql/operators.py
custom_function
custom_function(uri: URIRef, override: bool = False, raw: bool = False) -> Callable[[_CustomFunction], _CustomFunction]
Decorator version of :func:register_custom_function.
Source code in rdflib/plugins/sparql/operators.py
date
date(e: Literal) -> date
Source code in rdflib/plugins/sparql/operators.py
dateTimeObjects
dateTimeObjects(expr: Literal) -> Any
return a dataTime/date/time/duration/dayTimeDuration/yearMonthDuration python objects from a literal
default_cast
default_cast(e: Expr, ctx: FrozenBindings) -> Literal
Source code in rdflib/plugins/sparql/operators.py
isCompatibleDateTimeDatatype
isCompatibleDateTimeDatatype(obj1: Union[date, datetime], dt1: URIRef, obj2: Union[Duration, timedelta], dt2: URIRef) -> bool
Returns a boolean indicating if first object is compatible with operation(+/-) over second object.
Source code in rdflib/plugins/sparql/operators.py
literal
not_
not_(arg) -> Expr
numeric
numeric(expr: Literal) -> Any
return a number from a literal http://www.w3.org/TR/xpath20/#promotion
or TypeError
Source code in rdflib/plugins/sparql/operators.py
register_custom_function
register_custom_function(uri: URIRef, func: _CustomFunction, override: bool = False, raw: bool = False) -> None
Register a custom SPARQL function.
By default, the function will be passed the RDF terms in the argument list. If raw is True, the function will be passed an Expression and a Context.
The function must return an RDF term, or raise a SparqlError.
Source code in rdflib/plugins/sparql/operators.py
simplify
Source code in rdflib/plugins/sparql/operators.py
string
Make sure the passed thing is a string literal i.e. plain literal, xsd:string literal or lang-tagged literal
Source code in rdflib/plugins/sparql/operators.py
unregister_custom_function
unregister_custom_function(uri: URIRef, func: Optional[Callable[..., Any]] = None) -> None
The ‘func’ argument is included for compatibility with existing code. A previous implementation checked that the function associated with the given uri was actually ‘func’, but this is not necessary as the uri should uniquely identify the function.