N3 Builtin Functions

Draft Community Group Report,

More details about this document
This version:
https://domel.github.io/n3builtins/specification/
Latest published version:
https://domel.github.io/n3buildins/specification/
Previous Versions:
Feedback:
GitHub
Editors:
(University of Ottawa)
(IDLab - Ghent University)
Contributors:
Tim Duval, UnifyLogic, tim.duval@unifylogic.ai
Dominik Tomaszuk, University of Bialystok, d.tomaszuk@uwb.edu.pl

Abstract

This document defines the Notation 3 builtins. These are predicates with pre-defined semantics for querying, manipulating and reasoning over N3 documents.

Status of this document

1. Status of this Document

2. Builtin namespaces

N3 defines a core set of builtins: Builtins are grouped into distinct vocabularies depending on the N3 triple elements they operate on (e.g., string, list), or their particular topic (e.g., time, cryptography, log). Builtins are denoted by a controlled IRI defined in one of the core builtin namespaces:

3. Builtin arguments

An N3 builtin operates on its arguments. An argument is a placeholder that refers to an N3 triple element from the builtin statement, i.e., the N3 statement where the builtin acts as a predicate.

In the simplest case, there are two arguments that respectively refer to the subject and object of the builtin statement. For instance, statements such as 1 math:lessThan 2 have two arguments $s and $o, which is written as $s math:lessThan $o.

Arguments can be also represent a "deconstruction" of the subject or object in case of lists. For instance, (1 2 3) math:sum 6 will have arguments $s.1 .. $s.n and $o, which is written as ($s.1 .. $s.n) math:sum $o.

3.1. Argument modes

For a given builtin, an argument will have a defined >argument mode that stipulates whether it should be bound or not in the builtin statement. This binding requirement determines whether the argument can serve as builtin input, output, or both. Note that these modes are mostly based on Prolog argument modes.

3.2. Argument domains

An N3 builtin often has an expected datatype for its arguments, called the domain datatype. If the datatype of an argument value, called the value datatype, does not match the domain datatype, it may be possible to cast the value’s datatype to, or substitute it for, the domain datatype.

The expected datatypes of arguments, i.e., domain datatypes, are defined per N3 builtin.

If the value datatype and domain datatype do not match, and no casting or substitution is possible, the builtin statement will be considered false. (We point out that this is in line with the concept of the builtin theory box: a BPG search using the builtin statement will not match any statement in the theory box when literal datatypes do not match.)

Below, we elaborate on the type casting, promotion or substitution that may be applied to align domain datatypes with value datatypes.

3.2.1. Numeric datatype promotion and substitution

If the numeric value datatype does not match the domain datatype, it may be possible to promote or substitute the numeric value datatype:

Numeric type promotion: A numeric value datatype that is derived from the domain datatype can be promoted to the latter (e.g., xs:integer is derived from xs:decimal). This is done by casting the original value to the required datatype.

If there is no direct derivation relation between the value and domain datatype, the following numeric type promotions can take place:

Numeric type substitution: if all values have the same numeric datatype, and this datatype is derived from the domain datatype (e.g., xs:integer is derived from xs:decimal), then the values can be used without any casting. For example, if two xs:integer values are used for input where xs:decimal domains are expected, then the values retain their datatype as xs:integer. The substituted numeric datatype (in this case, xs:integer) will also apply to the builtin’s output, if any.

Builtins operating on any numeric type: some N3 builtins (e.g., math:sum) operate on values of any numeric type (i.e., xs:numeric, the union of xs:double, xs:float, and xs:decimal). I.e., their concrete input values may present any combination of numeric types. In that case, the builtin can only be applied if all value datatypes can be promoted into a common numeric datatype in the ordered list (xs:integer, xs:decimal, xs:float, xs:double). If so, at that point, we rely on numeric type substitution. For instance:

3.2.2. Other kinds of datatype casting

If the non-numeric value datatype does not match the domain datatype, it may be possible to cast the value datatype to the domain datatype:

String: A literal will be considered a "string" when it has an xs:string datatype, a rdf:langString datatype due to the presence of a language tag, or when it lacks a datatype.

Other datatypes: other types of datatype casting may take place as defined in XPath.

Editors' Note:

There is a useful chart for casting primitive types to primitive types in XPath, a subset of which is defined for SPARQL 1.1.

4. Builtin Evaluation

4.1. Builtin theory box

A builtin statement can be seen as a constrained basic graph pattern (BGP) search on the N3 builtin theory box. This builtin theory box is defined to include all truthful builtin statements for the N3 builtin. In case this BGP search matches one or more statements in the theory box, taking into account options for datatype casting, promotion, or substitution (see Argument domains) the N3 builtin statement will be considered true.

For eample, for the math:sum builtin, the builtin theory box includes all grounded builtin statements of the form ($s.1 .. $s.n) math:sum $o ., where argument values have datatype xs:numeric and, for each statement, the sum of $s.1 .. $s.n equals $o. Below, we give several examples of how this theory box is used to evaluate builtin statements.

Hence, in both cases, the builtin statement will be considered true, and the set of matching triples from the theory box will be used to instantiate the builtin statement. In the first case, this will lead to a single instance of the builtin statement, where variable ?x will be bound to value 6. In the second case, the grounded builtin statement will itself serve as such an instance.

Editors' Note:

Note that there can be multiple matching triples, thus leading to multiple instances of the builtin statement. Consider the following example for the list:member builtin:

( 1 2 3 ) list:member ?x .
This will yield the following matching triples from the builtin theory box:

( 1 2 3 ) list:member 1 .
( 1 2 3 ) list:member 2 .
( 1 2 3 ) list:member 3 .

The BGP search is constrained in order to avoid infinite numbers of results and intractable calculations; in other cases, constraints weigh utility vs. difficulty of implementation. For example, the builtin statement (?a 1) math:sum 2 would match an infinite number of grounded builtin statements. In other cases, the BGP search is restricted due to practical considerations. For instance, builtin statement (1 ?x) math:sum 6 would match only a single grounded builtin statement in the theory box, but this would complicate the implementation of the builtin for only limited utility (as other builtins can be used instead to subtract 1 from 6).

These constraints are encoded in terms of argument modes and domain datatypes in the respective builtin definitions. In case these constraints are not met, the builtin statement will evaluate to false.

5. Builtins

5.1. crypto

5.1.1. crypto:sha

Gets as object the SHA-1 hash of the subject.

true if and only if $o is the SHA-1 hash of $s.

Schema
$s+ crypto:sha $o-

5.2. list

5.2.1. list:append

Appends the lists from the subject list into a single list as object.

true if and only if $o is the concatenation of all lists $s.i.

Schema
( $s.i?[*] )+ list:append $o?

where:
$s.i: rdf:List
$o: rdf:List

Examples
Try in Notation3 Editor 🚀

Is the list (1 2 3 4) equal to appending (1), (2 3) , (4)?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ ( (1) (2 3) (4) ) list:append (1 2 3 4) . } => { :result :is true . } .

Result:

@prefix : <http://example.org/>.
:result :is true. 

Try in Notation3 Editor 🚀

What do we need to prepend to (3 4) to get (1 2 3 4)?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ ( ?what (3 4) ) list:append (1 2 3 4) . } => { :result :is ?what . } .

Result:

@prefix : <http://example.org/>.
:result :is (1 2). 

Try in Notation3 Editor 🚀

Append (3 4) to the list (1 2).

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ ( (1 2) (3 4) ) list:append ?list . } => { :result :is ?list . } .

Result:

@prefix : <http://example.org/>.
:result :is (1 2 3 4). 

Try in Notation3 Editor 🚀

What do we need to append to (1 2) to get (1 2 3 4)?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ ( (1 2) ?what ) list:append (1 2 3 4) . } => { :result :is ?what . } .

Result:

@prefix : <http://example.org/>.
:result :is (3 4). 

5.2.2. list:first

Gets the first element of the subject list as object.

true if and only if $ is a list and $o is the first member of that list.

Schema
$s+ list:first $o-

where:
$s: rdf:List

Examples
Try in Notation3 Editor 🚀

What is the first element of ( (a) { :a :b :c } 42 )?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ ( ('a') { :a :b :c } 42 ) list:first ?what . } => { :result :is ?what . } .

Result:

@prefix : <http://example.org/>.
:result :is ('a'). 

5.2.3. list:in

Checks whether the subject is found in the object list.

true if and only if $o is a list and $s is a member of that list.

Schema
$s-[*] list:in $o+

where:
$o: rdf:List

Examples
Try in Notation3 Editor 🚀

Does ( "dog" "penguin" "cat" ) contain a "cat"?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ "cat" list:in ( "dog" "penguin" "cat" ) . } => { :result :is true . } .

Result:

@prefix : <http://example.org/>.
:result :is true. 

Try in Notation3 Editor 🚀

What are the members of ( "dog" "penguin" "cat" )?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ ?what list:in ( "dog" "penguin" "cat" ) . } => { :result :is ?what . } .

Result:

@prefix : <http://example.org/>.
:result :is "dog" .
:result :is "penguin" . 
:result :is "cat" .

5.2.4. list:iterate

Iterates over each member of the subject list, getting their index/value pairs as the object.

true if and only if $s is a list and $o is a list with two elements: $o.1 is a valid index in list $s (index starts at 0), and $o.2 is found at that index in list $s.

Schema
$s+ list:iterate ( $o.1?[*] $o.2?[*] )?[*]

where:
$s: rdf:List
$o.1: xsd:integer

Examples
Try in Notation3 Editor 🚀

What is the index of "cat" in the list ("dog" "penguin" "cat")?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

:let :param ("dog" "penguin" "cat") .
{
    :let :param ?param . 
    ?param list:iterate (?index "cat") .  
}
=> 
{ 
    :result :is ?index . 
} .

Result:

@prefix : <http://example.org/>.
:result :is 2 .

Try in Notation3 Editor 🚀

Iterate over the list ("dog" "penguin" "cat").

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ ("dog" "penguin" "cat") list:iterate (?index ?member) . } => { :result :is (?index ?member) . } .

Result:

@prefix : <http://example.org/>.
:result :is (0 "dog") .
:result :is (1 "penguin") .
:result :is (2 "cat") .

Try in Notation3 Editor 🚀

Is "cat" the third item in the list ("dog" "penguin" "cat")?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

:let :param ("dog" "penguin" "cat") .
{
    :let :param ?param . 
    ?param list:iterate (2 "cat") .  
}
=> 
{ 
    :result :is true . 
} .

Result:

@prefix : <http://example.org/>.
:result :is true .

5.2.5. list:last

Gets the last element of the subject list as object.

true if and only if $ is a list and $o is the last member of that list.

Schema
$s+ list:last $o-

where:
$s: rdf:List

Examples
Try in Notation3 Editor 🚀

Extract the last element of the list (1 2 3 4).

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ (1 2 3 4) list:last ?last . } => { :result :is ?last . } .

Result:

@prefix : <http://example.org/>.
:result :is 4. 

Try in Notation3 Editor 🚀

Test if the last element of the list (1 2 3 4) is 4.

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

:let :param (1 2 3 4).

{ 
    :let :param ?param .
    ?param list:last 4 . 
} 
=> 
{ 
    :result :is true . 
} .

Result:

@prefix : <http://example.org/>.
:result :is true. 

5.2.6. list:length

Gets the length of the subject list as object.

true if and only if $s is a list and $o is the integer length of that list.

Schema
$s+ list:length $o-

where:
$s: rdf:List

Examples
Try in Notation3 Editor 🚀

Calculate the length of the list (1 2 3 4).

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ (1 2 3 4) list:length ?length . } => { :result :is ?length . } .

Result:

@prefix : <http://example.org/>.
:result :is 4. 

5.2.7. list:member

Checks whether the subject list contains the object.

true if and only $s is a list and o is a member of that list.

Schema
$s+ list:member $o-[*]

where:
$s: rdf:List

Examples
Try in Notation3 Editor 🚀

Is "cat" a member of the list ("dog" "penguin" "cat")?

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

:let :param ("dog" "penguin" "cat") .

{ 
    :let :param ?param .
    ?param list:member "cat" . 
} 
=> 
{ 
    :result :is true . 
} .

Result:

@prefix : <http://example.org/>.
:result :is true.

Try in Notation3 Editor 🚀

Determine the members of the list ("dog" "penguin" "cat").

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

{ ("dog" "penguin" "cat") list:member ?member . } => { :result :is ?member . } .

Result:

@prefix : <http://example.org/>.
:result :is "dog".
:result :is "penguin".
:result :is "cat".

5.2.8. list:memberAt

Gets the member of the subject list at the given subject index as object (index starts at 0).

true if and only if $s.1 is a list, $s.2 is a valid index in list $s.1, and $o is found at that index in the list.

Schema
( $s.1+ $s.2?[*] )+ list:memberAt $o?[*]

where:
$s.1: rdf:List
$s.2: xsd:integer

Examples
Try in Notation3 Editor 🚀

Find the index of "cat" in the list ("dog" "cat" "penguin" "cat").

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

:let :param ("dog" "cat" "penguin" "cat").

{
    :let :param ?param .
    ( ?param ?index ) list:memberAt "cat" .
} 
=> 
{ 
    :result :is ?index . 
} .

Result:

@prefix : <http://example.org/>.
:result :is 1 .
:result :is 3 .

Try in Notation3 Editor 🚀

Get the third member of the list ("dog" "penguin" "cat").

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

:let :param ("dog" "penguin" "cat").

{
    :let :param ?param .
    ( ?param 2 ) list:memberAt ?third .
} 
=> 
{ 
    :result :is ?third . 
} .

Result:

@prefix : <http://example.org/>.
:result :is "cat" .

5.2.9. list:remove

Removes the subject member from the subject list, and returns the resulting list as object.

true if and only if $s.1 is a list, and $o is a list composed of the members of $s.1 with member $s.2 removed (if it was present; else, $o will be the same list).

Schema
( $s.1+ $s.2+ )+ list:remove $o-

where:
$s.1: rdf:List

Examples
Try in Notation3 Editor 🚀

Remove "penguin" from the list ("dog" "penguin" "cat" "penguin").

Formula:

@prefix : <http://example.org/>.
@prefix list: <http://www.w3.org/2000/10/swap/list#> .

:let :param ("dog" "penguin" "cat" "penguin") .
{ 
    :let :param ?param . 
    ( ?param "penguin" ) list:remove ?list .
} 
=> 
{ 
    :result :is ?list . 
} .

Result:

@prefix : <http://example.org/>.
:result :is ("dog" "cat").

5.3. log

5.3.1. log:conclusion

Gets all possible conclusions from the subject quoted graph, including rule inferences (deductive closure), as the object quoted graph.

true if and only if $o is the set of conclusions which can be drawn from $s (deductive closure), by applying any rules it contains to the data it contains.

Schema
$s+ log:conclusion $o?

where:
$s: log:Formula
$o: log:Formula

Examples
Try in Notation3 Editor 🚀

Draw all conclusions from the formula ":Felix a :Cat . { ?X a :Cat } => { ?X :says "Meow" . }".

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

:let :param { 
    :Felix a :Cat . 
    { ?X a :Cat . } => { ?X :says "Meow" . } .
} .

{ 
    :let :param ?param .
    ?param log:conclusion ?conclusion .
} 
=> 
{ 
    :result :is ?conclusion . 
} .

Result:

@prefix : <http://example.org/>.
:result :is {
    :Felix a :Cat. 
    :Felix :says "Meow". 
    { ?S a :Cat . } => { ?S :says "Meow" . } .
} .

5.3.2. log:conjunction

Merges the quoted graphs from the subject list into a single quoted graph as object.

true if and only if $o is a quoted graph that includes the contents of each of the quoted graphs $s.i.

Schema
( $s.i+ )+ log:conjunction $o?

where:
$s.i: log:Formula
$o: log:Formula

Examples
Try in Notation3 Editor 🚀

Merge the formulas "{ :Felix a :Cat . }" , "{ :Pluto a :Dog . }", "{ :Pingu a :Penguin . }" .

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ 
    ( { :Felix a :Cat . }
      { :Pluto a :Dog . }  
      { :Pingu a :Penguin . }
    ) log:conjunction ?merged .
} 
=> 
{ 
    :result :is ?merged . 
} .

Result:

@prefix : <http://example.org/>.
:result :is { 
    :Felix a :Cat . 
    :Pingu a :Penguin . 
    :Pluto a :Dog . 
} .

5.3.3. log:content

Dereferences the subject IRI and retrieves the online resource as the object string.

true if and only if $o is a string that represents the online resource to which $s is dereferenced.

Schema
$s+ log:content $o?

where:
$s: log:Uri
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Fetch the content of https://www.w3.org/People/Berners-Lee/card.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ 
    <https://www.w3.org/People/Berners-Lee/card> log:content ?content .
} 
=> 
{ 
    :result :is ?content . 
} .

Result:

:result :is "...the content of https://www.w3.org/People/Berners-Lee/card ...". 

5.3.4. log:dtlit

Creates a datatyped literal as object, based on the string value and datatype IRI in the subject list.

true if and only if $o is a datatyped literal with string value corresponding to $s.1 and datatype IRI corresponding to $s.2.

Schema
( $s.1? $s.2? )? log:dtlit $o?

where:
$s.1: xsd:string
$s.2: log:Uri
$o: log:Literal

Examples
Try in Notation3 Editor 🚀

Create a datatyped literal from the string "1971-05-05" and the type xsd:date.

Formula:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ ( "1971-05-05" xsd:date ) log:dtlit ?typed } => { :result :is ?typed . } .

Result:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
:result :is "1971-05-05"^^xsd:date.

Try in Notation3 Editor 🚀

Parse the datatyped literal "1971-05-05"^^xsd:date into a string and data type IRI.

Formula:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ 
    ( ?string ?type ) log:dtlit "1971-05-05"^^xsd:date .
} 
=> 
{ 
    :result :is ( ?string ?type ) . 
} .

Result:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
:result :is ("1971-05-05" xsd:date).

5.3.5. log:equalTo

Checks whether the subject and object N3 resources are the same. Can also be used to bind values to variables (see examples).

true if and only if $s and $o are the same N3 resource. Not to be confused with owl:sameAs.

Schema
$s? log:equalTo $o?Examples
Try in Notation3 Editor 🚀

Determine if "Cat" is equal to "Cat"@en .

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    # This will fail
    "Cat" log:equalTo "Cat"@en .
}
=>
{
    :result :is true .
} . 

Result:

@prefix : <http://example.org/>.
# no results

Try in Notation3 Editor 🚀

Determine if 1 is equal to 1 and "Cat" is equal to "Cat" and { :A :B :C . :D :E :F } is equal to { :D :E :F . :A :B :C }.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    1 log:equalTo 1 .
    "Cat" log:equalTo "Cat" .
    { :A :B :C . :D :E :F . } log:equalTo { :D :E :F . :A :B :C . } .
}
=>
{
    :result :is true .
} . 

Result:

@prefix : <http://example.org/>.
:result :is true. 

Try in Notation3 Editor 🚀

Assign values from the object list to universal variables given in the subject list. This can be compared to "destructuring" or "unpacking" in programming languages such as JavaScript or Python. In contrast to those languages, however, it works in either direction in N3. In general, this works because an effort is made to ensure the truth of builtin statements in N3.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    ( ?x ?y ?z ) log:equalTo ( 1 2 3 )
}
=>
{
    :result :is ?x , ?y , ?z .
} . 

Result:

@prefix : <http://example.org/>.
:result :is 1 , 2 , 3 . # objects can be in any order

Try in Notation3 Editor 🚀

Assign a value to an existential or universal variable.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    _:x log:equalTo 42 .
    ?q  log:equalTo "Cat"@en .

    # This will fail because _:x is already assigned to 42 .
    # _:x log:equalTo 17 .
}
=>
{
    :result :is ?q .
} . 

Result:

@prefix : <http://example.org/>.
:result :is "Cat"@en .

Try in Notation3 Editor 🚀

Assign values from the object list to universal variables given in the subject list. This can be compared to "destructuring" or "unpacking" in programming languages such as JavaScript or Python. In contrast to those languages, however, it works in either direction in N3. In general, this works because an effort is made to ensure the truthfulness of builtin statements in N3.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    ( "War and Peace" "Leo Tolstoy" 1225 ) log:equalTo ( ?title ?author ?numPages ) .
}
=>
{
    :result :is ?title , ?author , ?numPages .
} . 

Result:

@prefix : <http://example.org/>.
:result :is "War and Peace" , "Leo Tolstoy" , 1225 . # objects can be in any order

5.3.6. log:forAllIn

Two clauses are given in the subject list: for each result of the first clause, the builtin checks whether the second clause also holds for the result.

true if and only if, for each solution for which the first clause $s.1 is true, the second clause $s.2 is true as well. This is a scoped universal quantification.

Schema
( $s.1+ $s.2+ )+ log:forAllIn $o?

where:
$s.1: log:Formula
$s.2: log:Formula
$o: (Scope of the universal quantification. Leave as a variable to use current N3 document as scope.)

Examples
Try in Notation3 Editor 🚀

For each subtask of a composite task, check whether the subtask is completed.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

:c a :CompositeTask ;
    :subTask :s1 , :s2 , :s3 .
:s1 :state :Completed .
:s2 :state :Completed . 
:s3 :state :Completed .

{
    ?c a :CompositeTask .
    ( { ?c :subTask ?s } { ?s :state :Completed } ) log:forAllIn _:t .
}
=>
{
    :result :is true .
} . 

Result:

@prefix : <http://example.org/>.
:result :is true. 

5.3.7. log:includes

Checks whether the subject quoted graph includes the object quoted graph (taking into account variables). Can also be used to bind variables to values within the graph contents (see examples).

true if and only if there exists some substitution which, when applied to $o, creates a quoted graph $o' such that every statement in $o' is also in $s; whereby every variable, universally or existentially quantified in $o', is quantified in the same way in $s. Variable substitution is applied recursively to nested compound terms such as quoted graphs ans lists.

Schema
$s+ log:includes $o+

where:
$s: log:Formula
$o: log:Formula

Examples
Try in Notation3 Editor 🚀

Check whether the formula { :Felix a :Cat } includes { ?X a :Cat }.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ 
    { :Felix a :Cat } log:includes { ?X a :Cat } .
} 
=>
{
    :result :is ?X .
} .

Result:

@prefix : <http://example.org/>.
:result :is :Felix .

5.3.8. log:notEqualTo

Checks whether the subject and object N3 resources are _not_ the same.

true if and only if $s log:equalTo $o is false.

Schema
$s+ log:notEqualTo $o+Examples
Try in Notation3 Editor 🚀

Determine if 1 is not equal to 2 and "Cat" is not equal to "CAT" and { :A :B :C . } is not equal to { :C :B :A }.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    1 log:notEqualTo 2 .
    "Cat" log:notEqualTo "CAT" .
    { :A :B :C . } log:notEqualTo { :C :B :A . } .
}
=>
{
    :result :is true .
} . 

Result:

@prefix : <http://example.org/>.
:result :is true .

Try in Notation3 Editor 🚀

Check if an existential or universal variable is not equal to a value.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    _:x log:notEqualTo 42 .
    ?q  log:notEqualTo "Cat"@en .
}
=>
{
    :result :is true .
} . 

Result:

@prefix : <http://example.org/>.
# no result (the variables _:x and ?q are not bounded) 

Try in Notation3 Editor 🚀

Determine if "Cat" is not equal to "Cat"@en .

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    "Cat" log:notEqualTo "Cat"@en .
}
=>
{
    :result :is true .
} . 

Result:

@prefix : <http://example.org/>.
:result :is true .

5.3.9. log:notIncludes

Checks whether the subject quoted graph _does not_ include the object quoted graph (taking into account variables)

true if and only if $s log:includes $o is false.

Schema
$s+ log:notIncludes $o+

where:
$s: log:Formula
$o: log:Formula

Examples
Try in Notation3 Editor 🚀

Check whether the formula { :Felix a :Cat } does not include { ?X :eats ?Y }.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ 
    { :Felix a :Cat } log:notIncludes { ?X :eats ?Y } .
} 
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true.

Try in Notation3 Editor 🚀

Check whether the formula { :a :b :c } does not include { :a :b :d }.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ 
    # Dynamic evaluation of ?X and ?Y
    ?X log:notIncludes ?Y .
    ?X log:equalTo { :a :b :c }.
    ?Y log:equalTo { :a :b :d }.
} 
=>              
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true.

5.3.10. log:outputString

The N3 reasoner will print the object strings in the order of the subject keys, instead of printing the derivations or deductive closure. This may require a reasoner flag to be set.

The concrete semantics of this builtin (e.g., which N3 resource types are supported) will depend on the N3 reasoner.

Schema
$s+ log:outputString $o+

where:
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Print the two string "This is the first line " , "This is the second line " to the output.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

_:2 log:outputString "This is the second line
" .
_:1 log:outputString "This is the first line
" .

Result:

# If the reasoner support the outputString options
This is the first line
This is the second line

5.3.11. log:parsedAsN3

Parses the subject string into an object quoted graph.

true if and only if $s, when parsed as N3, gives $o. $s should be a syntactically valid string in N3 format.

Schema
$s+ log:parsedAsN3 $o-

where:
$s: xsd:string (should be a syntactically valid string in N3 format)
$o: log:Formula

Examples
Try in Notation3 Editor 🚀

Parse the string ':Socrates a :Human .' as N3.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

:Let :param """
@prefix : <urn:example:> .
:Socrates a :Human .
""" .

{
    :Let :param ?X .
    ?X log:parsedAsN3 ?Y .
}
=>
{
    :result :is ?Y .
} .

Result:

@prefix : <http://example.org/>.
:result :is { <urn:example:Socrates> a <urn:example:Human> . } .

5.3.12. log:rawType

Gets the type of the N3 resource.

true if and only if the N3 resource type of $s is $o. N3 resource types include log:Formula, log:Literal, log:List, log:Set or log:Other.

Schema
$s+ log:rawType $o-

where:
$o: log:Uri

Examples
Try in Notation3 Editor 🚀

Get the type of resources.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    <http://www.w3c.org> log:rawType ?resourceType .
}
=>
{
    :result :is ?resourceType .
} .

Result:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
:result :is log:Other.

Try in Notation3 Editor 🚀

Get the type of lists and quoted graphs.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    (1 2 3 4) log:rawType ?listType .
    { :s :p :o } log:rawType ?graphType .
} 
=>
{
    :result :is ( ?listType ?graphType ) .
} .

Result:

@prefix : <http://example.org/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
:result :is ( rdf:List log:Formula ) .

Try in Notation3 Editor 🚀

Get the type of literal resources.

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
    "Hello" log:rawType ?stringType .
    42 log:rawType ?integerType .
    true log:rawType ?trueType .
    false log:rawType ?falseType .
}
=>
{
    :result :is ( ?stringType ?integerType ?trueType ?falseType ) .
} .

Result:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
:result :is ( log:Literal log:Literal log:Literal log:Literal ) .

5.3.13. log:semantics

Gets as object the quoted graph that results from parsing an online (N3) string, found by dereferencing the subject IRI.

true if and only if $o is a quoted graph that results from parsing the string that results from dereferencing $s.

Schema
$s+ log:semantics $o?

where:
$s: log:Uri
$o: log:Formula

Examples
Try in Notation3 Editor 🚀

Read the contents of the file <semantics.data> and parse it as Notation3. We assume <semantics.data> contains the text:

@prefix : <http://example.org/>.
:Socrates a :Human .

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ <semantics.data> log:semantics ?semantics . } => { :result :is ?semantics } .

Result:

@prefix : <http://example.org/>.
:result :is { :Socrates a :Human . } .

5.3.14. log:semanticsOrError

Either gets as object the quoted graph that results from parsing an online (N3) string, found by dereferencing the subject IRI; or an error message that explains what went wrong.

true if and only if (a) $o is a quoted graph that results from parsing the string that results from dereferencing $s; or (b) an error message explaining what went wrong.

Schema
$s+ log:semanticsOrError $o?

where:
$s: log:Uri
$o: (either a log:Formula or xsd:string)

Examples
Try in Notation3 Editor 🚀

Read the contents a non existing <error.data> and parse it as Notation3 (which of course will fail).

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ <error.data> log:semantics ?semantics . } => { :result :is ?semantics } .

Result:

@prefix : <http://example.org/>.
:result :is """Unable to access document <file:////tmp/error.data>, because:
    <urlopen error [Errno 2] No such file or directory: '//tmp/error.data'>""" .

5.3.15. log:skolem

Gets as object a skolem IRI that is a function of the subject (commonly a list); the same subject will always result in the same skolem IRI.

true if and only if $o is a skolem IRI that is a function of the subject.

Schema
$s+ log:skolem $o-Examples
Try in Notation3 Editor 🚀

Generate a unique Skolem IRI from the list (:abc 77 "xyz") .

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ (:abc 77 "xyz") log:skolem ?skolem . } => { :result :is ?skolem } .

Result:

@prefix : <http://example.org/>.
:result :is <http://www.w3.org/2000/10/swap/genid#zmgk3Vt_z_u7FQlk1NmqIw> . 

5.3.16. log:uri

Gets as object the string representation of the subject URI.

true if and only if $o is the string representation of $s.

Schema
$s? log:uri $o?

where:
$s: (a URI)
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Parse the URI <https://www.w3.org> into a string .

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ <https://www.w3.org> log:uri ?uri . } => { :result :is ?uri . } .

Result:

@prefix : <http://example.org/>.
:result :is "https://www.w3.org" .

5.3.17. log:langlit

Creates a language-tagged literal as object, based on the string value and language tag (see BCP47) in the subject list.

true if and only if $o is a language-tagged literal with string value corresponding to $s.1 and language tag corresponding to $s.2. $s.2 should be a string in the form of a BCP47 language tag.

Schema
( $s.1? $s.2? )? log:langlit $o?

where:
$s.1: xsd:string
$s.2: xsd:string
$o: log:Literal

Examples
Try in Notation3 Editor 🚀

Create a language-tagged literal from the string "hello" and language tag "en".

Formula:

@prefix : <http://example.org/>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
{ ("hello" "en") log:langlit ?X } => { ?X a :Result } .

Result:

@prefix : <http://example.org/>.
"hello"@en a :Result .

5.4. math

5.4.1. math:absoluteValue

Calculates as object the absolute value of the subject.

true if and only if $o is the absolute value of $s.

Schema
$s+ math:absoluteValue $o-

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the absolute value of the value -2.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param -2 .

{
    :Let :param ?param .
    ?param math:absoluteValue ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 2. 

5.4.2. math:acos

Calculates the object as the arc cosine value of the subject.

true if and only if $o is the arc cosine value of $s.

Schema
$s? math:acos $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the arc cosine of the value 1.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param 1 .

{
    :Let :param ?param .
    ?param math:acos ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 0.0 .

5.4.3. math:asin

Calculates the object as the arc sine value of the subject.

true if and only if $o is the arc sine value of $s.

Schema
$s? math:asin $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the arc sine of the value 1.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param 1 .

{
    :Let :param ?param .
    ?param math:asin ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 1.5707963267948966 .

5.4.4. math:atan

Calculates the object as the arc tangent value of the subject.

true if and only if $o is the arc tangent value of $s.

Schema
$s? math:atan $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the arc tangent of the value 1.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param 1 .

{
    :Let :param ?param .
    ?param math:atan ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 0.7853981633974483 .

5.4.5. math:cos

Calculates the object as the cosine value of the subject.

true if and only if $o is the cosine value of $s.

Schema
$s? math:cos $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float) (angle expressed in radians)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the cosine of the value 0.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param 0 .

{
    :Let :param ?param .
    ?param math:cos ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 1.0 .

5.4.6. math:cosh

Calculates the object as the hyperbolic cosine value of the subject.

true if and only if $o is the hyperbolic cosine value of $s.

Schema
$s? math:cosh $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float) (angle expressed in radians)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the hyperbolic cosine of the value 0.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param 0 .

{
    :Let :param ?param .
    ?param math:cosh ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 1.0 .

5.4.7. math:degrees

Calculates the object as the value in degrees corresponding to the radians value of the subject.

true if and only if $o is the value in degrees corresponding to the radians value of $s.

Schema
$s? math:degrees $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float) (angle expressed in radians)
$o: (xsd:decimal | xsd:double | xsd:float) (angle expressed in degrees)

Examples
Try in Notation3 Editor 🚀

Calculate the degrees of the radians value 1.57079632679.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param 1.57079632679 .

{
    :Let :param ?param .
    ?param math:degrees ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 89.99999999971946 .

5.4.8. math:difference

Calculates the object by subtracting the second number from the first number given in the subject list.

true if and only if $o is the result of subtracting $s.2 from $s.1.

Schema
( $s.1+ $s.2+ )+ math:difference $o-

where:
$s.1: (xsd:decimal | xsd:double | xsd:float)
$s.2: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the value of 7 minus 2.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (7 2) .

{
    :Let :param ?param .
    ?param math:difference ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 5.

5.4.9. math:equalTo

Checks whether the subject and object are the same number.

true if and only if $s is the same number as $o.

Schema
$s? math:equalTo $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Check if the numbers 42 and 42 are equal .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (42 42) .

{
    :Let :param (?X ?Y) .
    ?X math:equalTo ?Y .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.4.10. math:exponentiation

Calculates the object as the result of raising the first number to the power of the second number in the subject list. You can also use this to calculate the logarithm of the object, with as base the first number of the subject list (see examples).

true if and only if $o is the result of raising $s.1 to the power of $s.2

Schema
( $s.1+ $s.2? )+ math:exponentiation $o?

where:
$s.1: (xsd:decimal | xsd:double | xsd:float)
$s.2: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the value of 7 raised to the power of 2 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (7 2) .

{
    :Let :param ?param .
    ?param math:exponentiation ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 49 .

Try in Notation3 Editor 🚀

Calculate the logarithm of 49 base 2 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

{
    (7 ?result) math:exponentiation 49 .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 2.0 .

5.4.11. math:greaterThan

Checks whether the subject is a number that is greater than the object.

true if and only if $s is a number that is greater than $o.

Schema
$s+ math:greaterThan $o+

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Check if 42 is greater than 41 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (42 41) .

{
    :Let :param (?X ?Y) .
    ?X math:greaterThan ?Y .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true .

5.4.12. math:lessThan

Checks whether the subject is a number that is less than the object.

true if and only if $s is a number that is less than $o.

Schema
$s+ math:lessThan $o+

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Check if 41 is less than 42 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (41 42) .

{
    :Let :param (?X ?Y) .
    ?X math:lessThan ?Y .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true .

5.4.13. math:negation

Calculates the object as the negation of the subject.

true if and only if $o is the negation of $s.

Schema
$s? math:negation $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the negation of the value 42 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param 42 .

{
    :Let :param ?param .
    ?param math:negation ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is -42 .

5.4.14. math:notEqualTo

Checks whether the subject and object are not the same number.

true if and only if $s is the not same number as $o.

Schema
$s+ math:notEqualTo $o+

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Check if the numbers 41 and 42 are not equal .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (41 42) .

{
    :Let :param (?X ?Y) .
    ?X math:notEqualTo ?Y .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true .

5.4.15. math:notGreaterThan

Checks whether the subject is a number that is not greater than the object. You can use this as an equivalent of a lessThanOrEqual operator.

true if and only if $s is a number that is not greater than $o.

Schema
$s+ math:notGreaterThan $o+

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Check if 41 is not greater than 42 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (41 42) .

{
    :Let :param (?X ?Y) .
    ?X math:notGreaterThan ?Y .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true .

5.4.16. math:notLessThan

Checks whether the subject is a number that is not less than the object. You can use this as an equivalent of a greaterThanOrEqual operator.

true if and only if $s is a number that is not less than $o.

Schema
$s+ math:notLessThan $o+

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Check if 42 is not less than 41 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (42 41) .

{
    :Let :param (?X ?Y) .
    ?X math:notLessThan ?Y .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true .

5.4.17. math:product

Calculates the object as the product of the numbers given in the subject list.

true if and only if $o is the arithmetic product of all numbers $s.i

Schema
( $s.i+ )+ math:product $o-

where:
$s.i: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the product of 2 and 21.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (2 21) .

{
    :Let :param ?param .
    ?param math:product ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 42.

Try in Notation3 Editor 🚀

Calculate the product of 2,4,6, and 8 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (2 4 6 8) .

{
    :Let :param ?param .
    ?param math:product ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 384.

5.4.18. math:quotient

Calculates the object by dividing the first number by the second number given in the subject list.

true if and only if $o is the result of dividing $s.1 by $s.2.

Schema
( $s.1+ $s.2+ )+ math:quotient $o-

where:
$s.1: (xsd:decimal | xsd:double | xsd:float)
$s.2: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the quotient of 42 and 2.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (42 2) .

{
    :Let :param ?param .
    ?param math:quotient ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 21. 

5.4.19. math:remainder

Calculates the object as the remainder of the division of the first integer by the second integer given in the subject list.

true if and only if $o is the remainder of dividing $s.1 by $s.2.

Schema
( $s.1+ $s.2+ )+ math:remainder $o-

where:
$s.1: xsd:integer
$s.2: xsd:integer
$o: xsd:integer

Examples
Try in Notation3 Editor 🚀

Calculate the remainder of 10 divided by 3.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (10 3) .

{
    :Let :param ?param .
    ?param math:remainder ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 1.

5.4.20. math:rounded

Calculates the object as the integer that is closest to the subject number.

true if and only if $o is the integer that is closest to $s. If there are two such numbers, then the one closest to positive infinity is returned.

Schema
$s+ math:rounded $o-

where:
$s: (xsd:decimal | xsd:double | xsd:float)
$o: xsd:integer

Examples
Try in Notation3 Editor 🚀

Calculate the rounded version of 3.3.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:Let :param "3.3"^^xsd:double .

{
    :Let :param ?param .
    ?param math:rounded ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 3. 

5.4.21. math:sin

Calculates the object as the sine value of the subject.

true if and only if $o is the sine value of $s.

Schema
$s? math:sin $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float) (angle expressed in radians)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the sin of pi/2 (1.57079632679) .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:Let :param "1.57079632679"^^xsd:double .

{
    :Let :param ?param .
    ?param math:sin ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
:result :is "1.0"^^xsd:double . 

5.4.22. math:sinh

Calculates the object as the hyperbolic sine value of the subject.

true if and only if $o is the hyperbolic sine value of $s.

Schema
$s? math:sinh $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float) (angle expressed in radians)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the sinh of log(1 + sqrt(2)) (0.88137358701954302).

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:Let :param "0.88137358701954302"^^xsd:double.

{
    :Let :param ?param .
    ?param math:sinh ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 1.0.

5.4.23. math:sum

Calculates the object as the sum of the numbers given in the subject list.

true if and only if $o is the arithmetic sum of all numbers $s.i

Schema
( $s.i+ )+ math:sum $o-

where:
$s.i: (xsd:decimal | xsd:double | xsd:float)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the sum of 1,2,3,4,5,6,7,8,9,10.

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

:Let :param (1 2 3 4 5 6 7 8 9 10) .

{
    :Let :param ?param .
    ?param math:sum ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 55.

5.4.24. math:tan

Calculates the object as the tangent value of the subject.

true if and only if $o is the tangent value of $s.

Schema
$s? math:tan $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float) (angle expressed in radians)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the tangent of the value 0.7853981633974483 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:Let :param "0.7853981633974483"^^xsd:double .

{
    :Let :param ?param .
    ?param math:tan ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
:result :is "0.9999999999999999"^^xsd:double. 

5.4.25. math:tanh

Calculates the object as the hyperbolic tangent value of the subject.

true if and only if $o is the hyperbolic tangent value of $s.

Schema
$s? math:tanh $o?

where:
$s: (xsd:decimal | xsd:double | xsd:float) (angle expressed in radians)
$o: (xsd:decimal | xsd:double | xsd:float)

Examples
Try in Notation3 Editor 🚀

Calculate the hyperbolic tanget of 0.549306 .

Formula:

@prefix : <http://example.org/>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:Let :param "0.549306"^^xsd:double .

{
    :Let :param ?param .
    ?param math:tanh ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
:result :is "0.49999989174945103"^^xsd:double. 

5.5. string

5.5.1. string:concatenation

Concatenates the strings from the subject list into a single string as object.

true if and only if the string concatenation of $s.i equals $o.

Schema
( $s.i+ )+ string:concatenation $o-

where:
$s.i: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Concatenates the string "hello", " " and "world!".

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param ( "hello" " " "world!" ) .

{
    :Let :param ?param .
    ?param string:concatenation ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is "hello world!". 

5.5.2. string:contains

Checks whether the subject string contains the object string.

true if and only if $s contains $o.

Schema
$s+ string:contains $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "hello world!" contains the string "llo worl".

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "hello world!" .
:Let :param2 "llo worl".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:contains ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.3. string:containsIgnoringCase

Checks whether the subject string contains the object string, ignoring differences between lowercase and uppercase.

true if and only if $s contains $o when ignoring case differences.

Schema
$s+ string:containsIgnoringCase $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "hello world!" contains the string "lLO woRl".

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "hello world!" .
:Let :param2 "lLO woRl".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:containsIgnoringCase ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.4. string:endsWith

Checks whether the subject string ends with the object string.

true if and only if $s ends with $o.

Schema
$s+ string:endsWith $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "hello world!" ends with "orld!".

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "hello world!" .
:Let :param2 "orld!".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:endsWith ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.5. string:equalIgnoringCase

Checks whether the subject string is the same as the object string, ignoring differences between lowercase and uppercase.

true if and only if $s is the same string as $o when ignoring case differences.

Schema
$s+ string:equalIgnoringCase $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "hello world!" is equal to "hELLo wORld!" ignoring the case .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "hello world!" .
:Let :param2 "hELLo wORld!" .
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:equalIgnoringCase ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.6. string:format

Calculates the object as the result of replacing the tags in the first string from the subject list with the remaining strings from the subject list. See C’s sprintf function for details on these tags.

true if and only if $o is the result of replacing the tags found in $s.(i=1) with the strings $s.(i>1)

Schema
( $s.i+ )+ string:format $o-

where:
$s.i: xsd:string ($s.(i=1) is a format string including tags. $s.(i>1) are strings to replace these tags. See C’s sprintf function for details.)
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Calculate the result of applying the format "%s://%s/%s" to the strings "https", "w3c.github.io" and "N3/spec" .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param ( "%s://%s/%s" "https" "w3c.github.io" "N3/spec/" ) .

{
    :Let :param ?param .
    ?param string:format ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is "https://w3c.github.io/N3/spec/". 

5.5.7. string:greaterThan

Checks whether the subject string is greater than the object string, according to Unicode code order.

true if and only if $s is greater than $o as per the Unicode code order.

Schema
$s+ string:greaterThan $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "Pengiun" is greater than the string "Cat" .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "Penguin" .
:Let :param2 "Cat".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:greaterThan ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.8. string:lessThan

Checks whether the subject string is less than the object string, according to Unicode code order.

true if and only if $s is less than $o as per the Unicode code order.

Schema
$s+ string:lessThan $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "Cat" is less than the string "Penguin" .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "Cat" .
:Let :param2 "Penguin".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:lessThan ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.9. string:matches

Checks whether the subject string matches the object regular expression. The regular expression follows the perl, python style.

true if and only if string $s matches the regular expression $o

Schema
$s+ string:matches $o+

where:
$s: xsd:string
$o: xsd:string (regular expression in perl, python style)

Examples
Try in Notation3 Editor 🚀

Checks whether the string "hello world!" matches the regular expression ".(l)+o wo.".

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "hello world!" .
:Let :param2 ".*(l)+o wo.*".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:matches ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.10. string:notEqualIgnoringCase

Checks whether the subject string is not the same as the object string, ignoring differences between lowercase and uppercase.

true if and only if $s is not the same string as $o when ignoring case differences.

Schema
$s+ string:notEqualIgnoringCase $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "hello world!" is not equal to "hELLo dunia!" ignorning the case .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "hello world!" .
:Let :param2 "hELLo dunia!" .
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:notEqualIgnoringCase ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.11. string:notGreaterThan

Checks whether the subject string is not greater than the object string, according to Unicode code order. You can use this as an equivalent of a lessThanOrEqual operator.

true if and only if $s is not greater than $o as per the Unicode code order.

Schema
$s+ string:notGreaterThan $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "Cat" is not greater than the string "Penguin" .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "Cat" .
:Let :param2 "Penguin".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:notGreaterThan ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.12. string:notLessThan

Checks whether the subject string is not less than the object string, according to Unicode code order. You can use this as an equivalent of a greaterThanOrEqual operator.

true if and only if $s is not less than $o as per the Unicode code order.

Schema
$s+ string:notLessThan $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "Penguin" is not less than the string "Cat" .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "Penguin".
:Let :param2 "Cat" .
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:notLessThan ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.13. string:notMatches

Checks whether the subject string does not match the object regular expression. The regular expression follows the perl, python style.

true if and only if string $s does not match the regular expression $o

Schema
$s+ string:notMatches $o+

where:
$s: xsd:string
$o: xsd:string (regular expression in perl, python style)

Examples
Try in Notation3 Editor 🚀

Checks whether the string "hello world!" no matches the regular expression ".(l)+o dunia.".

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "hello world!" .
:Let :param2 ".*(l)+o dunia.*".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:notMatches ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.5.14. string:replace

Calculates the object as the result of, given the strings in the subject list, replacing all occurrences of the second string in the first string with the third string.

true if and only if $o is the result of replacing all occurrences of $s.2 in $s.1 with $s.3

Schema
( $s.1+ $s.2+ $s.3+ )+ string:replace $o-

where:
$s.1: xsd:string
$s.2: xsd:string
$s.3: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Replace all "l"-s in the string "hello world!" with the bracket version "[l]" .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :data "hello world!" .
:Let :search "(l)" .
:Let :replace "[$1]" .
{
    :Let :data ?data .
    :Let :search ?search .
    :Let :replace ?replace .
    (?data ?search ?replace) string:replace ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is "he[l][l]o wor[l]d!". 

5.5.15. string:scrape

Calculates the object as the first matching group when, given the subject list, matching the second string as regular expression (with exactly 1 group) against the first string.

true if and only if $o is the first matching group when matching $s.2 as a regular expression against $s.1

Schema
( $s.1+ $s.2+ )+ string:scrape $o-

where:
$s.1: xsd:string
$s.2: xsd:string (regular expression with 1 group)
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Extract from the string "https://w3c.github.io/N3/spec/" the last path element using a regular expression .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "https://w3c.github.io/N3/spec/" . 
:Let :param2 ".*/([^/]+/)$" .
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    (?param1 ?param2) string:scrape ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is "spec/". 

5.5.16. string:startsWith

Checks whether the subject string starts with the object string.

true if and only if $s starts with $o.

Schema
$s+ string:startsWith $o+

where:
$s: xsd:string
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Checks whether the string "hello world!" starts with "hello" .

Formula:

@prefix : <http://example.org/>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

:Let :param1 "hello world!" .
:Let :param2 "hello".
{
    :Let :param1 ?param1 .
    :Let :param2 ?param2 .
    ?param1 string:startsWith ?param2 .
}
=>
{
    :result :is true .
} .

Result:

@prefix : <http://example.org/>.
:result :is true . 

5.6. time

5.6.1. time:day

Gets as object the integer day component of the subject xsd:dateTime.

true if and only if $o is the integer day component of $s.

Schema
$s+ time:day $o-

where:
$s: xsd:dateTime
$o: xsd:integer

Examples
Try in Notation3 Editor 🚀

Return the day component of the date "2023-04-01T18:06:04Z" .

Formula:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix time: <http://www.w3.org/2000/10/swap/time#> .

:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .

{
    :Let :param ?param .
    ?param time:day ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 1. 

5.6.2. time:minute

Gets as object the integer minutes component of the subject xsd:dateTime.

true if and only if $o is the integer minutes component of $s.

Schema
$s+ time:minute $o-

where:
$s: xsd:dateTime
$o: xsd:integer

Examples
Try in Notation3 Editor 🚀

Return the minute component of the date "2023-04-01T18:06:04Z" .

Formula:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix time: <http://www.w3.org/2000/10/swap/time#> .

:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .

{
    :Let :param ?param .
    ?param time:minute ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 6. 

5.6.3. time:month

Gets as object the integer month component of the subject xsd:dateTime.

true if and only if $o is the integer month component of $s.

Schema
$s+ time:month $o-

where:
$s: xsd:dateTime
$o: xsd:integer

Examples
Try in Notation3 Editor 🚀

Return the month component of the date "2023-04-01T18:06:04Z" .

Formula:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix time: <http://www.w3.org/2000/10/swap/time#> .

:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .

{
    :Let :param ?param .
    ?param time:month ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 4. 

5.6.4. time:second

Gets as object the integer seconds component of the subject xsd:dateTime.

true if and only if $o is the integer seconds component of $s.

Schema
$s+ time:second $o-

where:
$s: xsd:dateTime
$o: xsd:integer

Examples
Try in Notation3 Editor 🚀

Return the seconds component of the date "2023-04-01T18:06:04Z" .

Formula:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix time: <http://www.w3.org/2000/10/swap/time#> .

:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .

{
    :Let :param ?param .
    ?param time:second ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 4. 

5.6.5. time:timeZone

Gets as object the trailing timezone offset of the subject xsd:dateTime (e.g., "-05:00").

true if and only if $o is the timezone offset of $s.

Schema
$s+ time:timeZone $o-

where:
$s: xsd:dateTime
$o: xsd:string

Examples
Try in Notation3 Editor 🚀

Return the time zone component of the date "2023-04-01T18:06:04Z" .

Formula:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix time: <http://www.w3.org/2000/10/swap/time#> .

:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .

{
    :Let :param ?param .
    ?param time:minute ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is "Z". 

5.6.6. time:year

Gets as object the integer year component of the subject xsd:dateTime.

true if and only if $o is the integer year component of $s.

Schema
$s+ time:year $o-

where:
$s: xsd:dateTime
$o: xsd:integer

Examples
Try in Notation3 Editor 🚀

Return the minute component of the date "2023-04-01T18:06:04Z" .

Formula:

@prefix : <http://example.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix time: <http://www.w3.org/2000/10/swap/time#> .

:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .

{
    :Let :param ?param .
    ?param time:year ?result .
}
=>
{
    :result :is ?result .
} .

Result:

@prefix : <http://example.org/>.
:result :is 2023. 

6. Acknowledgements

The editors acknowledge valuable contributions from...