+
+Get the type of resources.
+
+
Formula:
+```
-### log:content ### {#log:content}
-Dereferences the subject IRI and retrieves the online resource as the object string.
+@prefix : .
+@prefix log: .
-`true` if and only if `$o` is a string that represents the online resource to which `$s` is dereferenced.
+{
+ log:rawType ?resourceType .
+}
+=>
+{
+ :result :is ?resourceType .
+} .
+
+```
+ Result:
+```
-**Schema**
`$s+ log:content $o?`
where:
`$s`: `log:Uri`
`$o`: `xsd:string`
-**Examples**
-
try in editor 🚀
+@prefix : .
+@prefix log: .
+:result :is log:Other.
+
+```
+
+
+
+
try in editor 🚀
-Fetch the content of https://www.w3.org/People/Berners-Lee/card.
+Get the type of literal resources.
Formula:
```
@@ -2021,148 +1927,134 @@ Fetch the content of https://www.w3.org/People/Berners-Lee/card.
@prefix : .
@prefix log: .
-{
- log:content ?content .
-}
-=>
-{
- :result :is ?content .
+{
+ "Hello" log:rawType ?stringType .
+ 42 log:rawType ?integerType .
+ true log:rawType ?trueType .
+ false log:rawType ?falseType .
+}
+=>
+{
+ :result :is ( ?stringType ?integerType ?trueType ?falseType ) .
} .
```
Result:
```
-:result :is "...the content of https://www.w3.org/People/Berners-Lee/card ...".
+@prefix : .
+@prefix log: .
+:result :is ( log:Literal log:Literal log:Literal log:Literal ) .
```
-### log:dtlit ### {#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`.
+### log:semantics ### {#log:semantics}
+Gets as object the graph term that results from parsing an online (N3) string, found by dereferencing the subject IRI.
-**See also**
log:langlit
+`true` if and only if `$o` is a graph term that results from parsing the string that results from dereferencing `$s`.
-**Schema**
`( $s.1? $s.2? )? log:dtlit $o?`where:
`$s.1`: `xsd:string`, `$s.2`: `log:Uri`
`$o`: `log:Literal`
+**Schema**
`$s+ log:semantics $o?`where:
`$s`: `log:Uri`
`$o`: `log:Formula`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Parse the datatyped literal "1971-05-05"^^xsd:date into a string and data type IRI.
+Read the contents of the file `` and parse it as Notation3.
+We assume `` contains the text:
+```
+ @prefix : .
+ :Socrates a :Human .
+```
Formula:
```
@prefix : .
-@prefix xsd: .
@prefix log: .
-{
- ( ?string ?type ) log:dtlit "1971-05-05"^^xsd:date .
-}
-=>
-{
- :result :is ( ?string ?type ) .
-} .
+{ log:semantics ?semantics . } => { :result :is ?semantics } .
```
Result:
```
@prefix : .
-@prefix xsd: .
-:result :is ("1971-05-05" xsd:date).
+:result :is { :Socrates a :Human . } .
```
-
-
try in editor 🚀
+
+### log:semanticsOrError ### {#log:semanticsOrError}
+Either gets as object the graph term 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 graph term 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 editor 🚀
-Create a datatyped literal from the string "1971-05-05" and the type xsd:date.
+Read the contents a non existing `` and parse it as Notation3 (which of course will fail).
Formula:
```
@prefix : .
-@prefix xsd: .
@prefix log: .
-{ ( "1971-05-05" xsd:date ) log:dtlit ?typed } => { :result :is ?typed . } .
-
+{ log:semanticsOrError ?semantics } => { :result :is ?semantics } .
```
Result:
```
@prefix : .
-@prefix xsd: .
-:result :is "1971-05-05"^^xsd:date.
+
+:result :is "error(existence_error(source_sink,/error.data),context(system:open/4,No such file or directory))" .
```
-### log:equalTo ### {#log:equalTo}
-Checks whether the subject and object N3 terms are the same (comparison occurs on the syntax level).
-Can also be used to bind values to variables (see examples).
-
-`true` if and only if `$s` and `$o` are the same N3 term.
-Not to be confused with owl:sameAs.
-Literals will be compared exactly: their datatypes must be identical (in case of strings, language tags must be identical).
+### log:skolem ### {#log:skolem}
+Gets as object a skolem IRI that is a function of the subject (commonly a list) and a concrete reasoning run (implicit); for one reasoning run, the same subject will always result in the same skolem IRI.
-**See also**
log:notEqualTo
+`true` if and only if `$o` is a skolem IRI that is produced by applying a skolem function to the subject.
-**Schema**
`$s? log:equalTo $o?`
+**Schema**
`$s+ log:skolem $o-`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Determine <http://famous.web.site> is equal to itself .
+Generate a unique Skolem IRI from the list (:abc 77 "xyz") .
Formula:
```
@prefix : .
@prefix log: .
-@prefix owl: .
-
- owl:sameAs .
-
-{
- log:equalTo .
- # But not
- #
- # log:equalTo .
- #
- # and not
- #
- # log:equalTo .
- #
-}
-=>
-{
- :result :is true .
-} .
+{ (:abc 77 "xyz") log:skolem ?skolem . } => { :result :is ?skolem } .
```
Result:
```
@prefix : .
-:result :is true.
+:result :is .
```
-
-
try in editor 🚀
+
+### log:uri ### {#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 editor 🚀
-Assign values from the subject list to universal variables given in the object 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.
-This mechanism works because an effort is made to ensure the truthfulness of builtin statements in N3.
+Parse the URI into a string .
Formula:
```
@@ -2170,393 +2062,439 @@ This mechanism works because an effort is made to ensure the truthfulness of bui
@prefix : .
@prefix log: .
-{
- ( "War and Peace" "Leo Tolstoy" 1225 ) log:equalTo ( ?title ?author ?numPages ) .
-}
-=>
-{
- :result :is ?title , ?author , ?numPages .
-} .
+{ log:uri ?uri . } => { :result :is ?uri . } .
```
Result:
```
@prefix : .
-:result :is "War and Peace" , "Leo Tolstoy" , 1225 . # objects can be in any order
+:result :is "https://www.w3.org" .
```
-
-
try in editor 🚀
+
+## math ## {#math}
+### math:absoluteValue ### {#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 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.
-This mechanism works because an effort is made to ensure the truth of builtin statements in N3.
+Calculate the absolute value of the value -2.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param -2 .
{
- ( ?x ?y ?z ) log:equalTo ( 1 2 3 )
+ :Let :param ?param .
+ ?param math:absoluteValue ?result .
}
=>
{
- :result :is ?x , ?y , ?z .
-} .
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-:result :is 1 , 2 , 3 . # objects can be in any order
+:result :is 2.
```
-
-
try in editor 🚀
+
+### math:acos ### {#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`.
+
+**See also**
math:cosmath:cosh
+
+**Schema**
`$s? math:acos $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Examples**
+
try in 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 }.
+Calculate the arc cosine of the value 1.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param 1 .
{
- 1 log:equalTo 1 .
- "Cat" log:equalTo "Cat" .
- { :A :B :C . :D :E :F . } log:equalTo { :D :E :F . :A :B :C . } .
+ :Let :param ?param .
+ ?param math:acos ?result .
}
=>
{
- :result :is true .
-} .
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-:result :is true.
+:result :is 0.0 .
```
-
-
try in editor 🚀
+
+### math:asin ### {#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`.
+
+**See also**
math:sinhmath:sin
+
+**Schema**
`$s? math:asin $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Examples**
+
try in editor 🚀
-Determine if "Cat" is equal to "Cat"@en .
+Calculate the arc sine of the value 1.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param 1 .
{
- # This will fail
- "Cat" log:equalTo "Cat"@en .
+ :Let :param ?param .
+ ?param math:asin ?result .
}
=>
{
- :result :is true .
-} .
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-# no results
+:result :is 1.5707963267948966 .
```
-
-
try in editor 🚀
+
+### math:atan ### {#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`.
+
+**See also**
math:tanmath:tanh
+
+**Schema**
`$s? math:atan $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Examples**
+
try in editor 🚀
-Assign a value to an existential or universal variable.
+Calculate the arc tangent of the value 1.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-{
- _:x log:equalTo 42 .
- ?q log:equalTo "Cat"@en .
+:Let :param 1 .
- # This will fail because _:x is already assigned to 42 .
- # _:x log:equalTo 17 .
+{
+ :Let :param ?param .
+ ?param math:atan ?result .
}
=>
{
- :result :is ?q .
-} .
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-:result :is "Cat"@en .
+:result :is 0.7853981633974483 .
```
-### log:forAllIn ### {#log:forAllIn}
-Two clauses are given in the subject list: for every match of the first clause,
- the builtin checks whether the second clause also holds for that match.
+### math:cos ### {#math:cos}
+Calculates the object as the cosine value of the subject.
-`true` if and only if, for every valid substitution of clause `$s.1`,
- i.e., a substitution of variables with terms that generates an instance of `$s.1` that is contained in the scope,
- the instance of `$s.2` generated by the same substitution is also contained in the scope.
-This applies a scoped quantification.
+`true` if and only if `$o` is the cosine value of `$s`.
-**Schema**
`( $s.1+ $s.2+ )+ log:forAllIn $o?`
where:
`$s.1`: `log:Formula`, `$s.2`: `log:Formula`
`$o`: (Scope of the builtin. Leave as a variable to use current N3 document as scope.)
+**See also**
math:acosmath:cosh
+
+**Schema**
`$s? math:cos $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-For each subtask of a composite task, check whether the subtask is completed.
+Calculate the cosine of the value 0.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-:c a :CompositeTask ;
- :subTask :s1 , :s2 , :s3 .
-:s1 :state :Completed .
-:s2 :state :Completed .
-:s3 :state :Completed .
+:Let :param 0 .
{
- ?c a :CompositeTask .
- ( { ?c :subTask ?s } { ?s :state :Completed } ) log:forAllIn _:t .
+ :Let :param ?param .
+ ?param math:cos ?result .
}
=>
{
- :result :is true .
-} .
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-:result :is true.
+:result :is 1.0 .
```
-### log:includes ### {#log:includes}
-Checks whether the subject graph term includes the object graph term (taking into account variables).
-Can also be used to bind variables to values within the graph contents (see examples).
+### math:cosh ### {#math:cosh}
+Calculates the object as the hyperbolic cosine value of the subject.
-`true` if and only if there exists some substitution which, when applied to `$s` and `$o`,
-creates graph terms `$s`' and `$o`' such that every statement in `$o`' is also in `$s`''.
-Variable substitution is applied recursively to nested compound terms such as graph terms and lists.
+`true` if and only if `$o` is the hyperbolic cosine value of `$s`.
-**See also**
log:notIncludes
+**See also**
math:acosmath:cos
-**Schema**
`$s+ log:includes $o+`
where:
`$s`: `log:Formula`
(Can also be left as a variable to use current N3 document as scope.)
`$o`: `log:Formula`
+**Schema**
`$s? math:cosh $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Check whether the formula { :Felix a :Cat } includes { ?X a :Cat }.
-
+Calculate the hyperbolic cosine of the value 0.
+
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-{
- { :Felix a :Cat } log:includes { ?X a :Cat } .
-}
+:Let :param 0 .
+
+{
+ :Let :param ?param .
+ ?param math:cosh ?result .
+}
=>
{
- :result :is ?X .
+ :result :is ?result .
} .
-
+
```
Result:
```
@prefix : .
-:result :is :Felix .
+:result :is 1.0 .
```
-
-
try in editor 🚀
-
-Check whether the current N3 document includes { ?X a :Cat }.
+### math:degrees ### {#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`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Examples**
+
try in editor 🚀
+
+Calculate the degrees of the radians value 1.57079632679.
+
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-:Felix a :Cat .
-:Tom a :Cat .
-:Rex a :Dog .
+:Let :param 1.57079632679 .
-{
- _:t log:includes { ?X a :Cat } .
-}
+{
+ :Let :param ?param .
+ ?param math:degrees ?result .
+}
=>
{
- :result :is ?X .
+ :result :is ?result .
} .
-
+
```
Result:
```
@prefix : .
-@prefix log: .
-
-:result :is :Felix.
-:result :is :Tom.
-
+:result :is 89.99999999971946 .
+
```
-### log:langlit ### {#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.
+### math:difference ### {#math:difference}
+Calculates the object by subtracting the second number from the first number given in the subject list.
-**See also**
log:dtlit
+`true` if and only if `$o` is the result of subtracting `$s.2` from `$s.1`.
-**Schema**
`( $s.1? $s.2? )? log:langlit $o?`
where:
`$s.1`: `xsd:string`, `$s.2`: `xsd:string`
`$o`: `log:Literal`
+**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 editor 🚀
+
try in editor 🚀
-Create a language-tagged literal from the string "hello" and language tag "en".
+Calculate the value of 7 minus 2.
Formula:
```
@prefix : .
-@prefix log: .
-{ ("hello" "en") log:langlit ?X } => { ?X a :Result } .
+@prefix math: .
+
+:Let :param (7 2) .
+
+{
+ :Let :param ?param .
+ ?param math:difference ?result .
+}
+=>
+{
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-"hello"@en a :Result .
+:result :is 5.
```
-### log:notEqualTo ### {#log:notEqualTo}
-Checks whether the subject and object N3 terms are _not_ the same (comparison occurs on the syntax level).
+### math:equalTo ### {#math:equalTo}
+Checks whether the subject and object are the same number.
-`true` if and only if `$s` and `$o` are _not_ the same N3 term.
+`true` if and only if `$s` is the same number as `$o`.
-**See also**
log:equalTo
+**See also**
math:notEqualTo
-**Schema**
`$s+ log:notEqualTo $o+`
+**Schema**
`$s? math:equalTo $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Determine if "Cat" is not equal to "Cat"@en .
+Check if the numbers 42 and 42 are equal .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param (42 42) .
{
- "Cat" log:notEqualTo "Cat"@en .
+ :Let :param (?X ?Y) .
+ ?X math:equalTo ?Y .
}
=>
{
:result :is true .
-} .
+} .
```
Result:
```
@prefix : .
-:result :is true .
+:result :is true .
```
-
-
try in editor 🚀
+
+### math:exponentiation ### {#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 editor 🚀
-Check if an existential or universal variable is not equal to a value.
+Calculate the logarithm of 49 base 2 .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
{
- _:x log:notEqualTo 42 .
- ?q log:notEqualTo "Cat"@en .
+ (7 ?result) math:exponentiation 49 .
}
=>
{
- :result :is true .
-} .
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-# no result (the variables _:x and ?q are not bounded)
+:result :is 2.0 .
```
-
try in editor 🚀
+
try in editor 🚀
-Check whether two graph terms, one containing a universal variable, are not equal.
+Calculate the value of 7 raised to the power of 2 .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param (7 2) .
{
-
- { :A :B :C . } log:notEqualTo { :A :B ?c } .
+ :Let :param ?param .
+ ?param math:exponentiation ?result .
}
=>
{
- :result :is true .
+ :result :is ?result .
} .
```
@@ -2564,31 +2502,41 @@ Check whether two graph terms, one containing a universal variable, are not equa
```
@prefix : .
-# no result (?c can be unified with :C)
+:result :is 49 .
```
-
-
try in editor 🚀
+
+### math:greaterThan ### {#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`.
+
+**See also**
math:notGreaterThan
+
+**Schema**
`$s+ math:greaterThan $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Examples**
+
try in 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 }.
+Check if 42 is greater than 41 .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param (42 41) .
{
- 1 log:notEqualTo 2 .
- "Cat" log:notEqualTo "CAT" .
- { :A :B :C . } log:notEqualTo { :C :B :A . } .
+ :Let :param (?X ?Y) .
+ ?X math:greaterThan ?Y .
}
=>
{
:result :is true .
-} .
+} .
```
Result:
@@ -2601,32 +2549,32 @@ Determine if 1 is not equal to 2 and "Cat" is not equal to "CAT" and { :A :B :C
-### log:notIncludes ### {#log:notIncludes}
-Checks whether the subject graph term _does not_ include the object graph term (taking into account variables)
+### math:lessThan ### {#math:lessThan}
+Checks whether the subject is a number that is less than the object.
-`true` if and only if `$s log:includes $o` is `false`.
+`true` if and only if `$s` is a number that is less than `$o`.
-**See also**
log:includes
+**See also**
math:notLessThan
-**Schema**
`$s+ log:notIncludes $o+`
where:
`$s`: `log:Formula`
`$o`: `log:Formula`
+**Schema**
`$s+ math:lessThan $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Check whether the formula { :a :b :c } does not include { :a :b :d }.
+Check if 41 is less than 42 .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-{
- # Dynamic evaluation of ?X and ?Y
- ?X log:notIncludes ?Y .
- ?X log:equalTo { :a :b :c }.
- ?Y log:equalTo { :a :b :d }.
-}
-=>
+:Let :param (41 42) .
+
+{
+ :Let :param (?X ?Y) .
+ ?X math:lessThan ?Y .
+}
+=>
{
:result :is true .
} .
@@ -2636,28 +2584,38 @@ Check whether the formula { :a :b :c } does not include { :a :b :d }.
```
@prefix : .
-:result :is true.
+:result :is true .
```
-
-
try in editor 🚀
+
+### math:negation ### {#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 editor 🚀
-Check whether the formula { :Felix a :Cat } does not include { ?X :eats ?Y }.
+Calculate the negation of the value 42 .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-{
- { :Felix a :Cat } log:notIncludes { ?X :eats ?Y } .
-}
+:Let :param 42 .
+
+{
+ :Let :param ?param .
+ ?param math:negation ?result .
+}
=>
{
- :result :is true .
+ :result :is ?result .
} .
```
@@ -2665,78 +2623,82 @@ Check whether the formula { :Felix a :Cat } does not include { ?X :eats ?Y }.
```
@prefix : .
-:result :is true.
+:result :is -42 .
```
-### log:outputString ### {#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.
+### math:notEqualTo ### {#math:notEqualTo}
+Checks whether the subject and object are not the same number.
-The concrete semantics of this builtin (e.g., which N3 resource types are supported) will depend on the N3 reasoner.
+`true` if and only if `$s` is the not same number as `$o`.
-**Schema**
`$s+ log:outputString $o+`
+**See also**
math:equalTo
+
+**Schema**
`$s+ math:notEqualTo $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Print the two string "This is the first line
-" , "This is the second line
-" to the output.
+Check if the numbers 41 and 42 are not equal .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-_:2 log:outputString "This is the second line\n" .
-_:1 log:outputString "This is the first line\n" .
+:Let :param (41 42) .
+
+{
+ :Let :param (?X ?Y) .
+ ?X math:notEqualTo ?Y .
+}
+=>
+{
+ :result :is true .
+} .
```
Result:
```
-# If the reasoner support the outputString options
-This is the first line
-This is the second line
+@prefix : .
+:result :is true .
```
-### log:parsedAsN3 ### {#log:parsedAsN3}
-Parses the subject string into an object graph term.
+### math:notGreaterThan ### {#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`, when parsed as N3, gives `$o`.
-`$s` should be a syntactically valid string in N3 format.
+`true` if and only if `$s` is a number that is not greater than `$o`.
-**See also**
log:semantics
+**See also**
math:greaterThan
-**Schema**
`$s+ log:parsedAsN3 $o-`
where:
`$s`: `xsd:string`
(should be a syntactically valid string in N3 format)
`$o`: `log:Formula`
+**Schema**
`$s+ math:notGreaterThan $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Parse the string ':Socrates a :Human .' as N3.
+Check if 41 is not greater than 42 .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-:Let :param """
-@prefix : .
-:Socrates a :Human .
-""" .
+:Let :param (41 42) .
{
- :Let :param ?X .
- ?X log:parsedAsN3 ?Y .
+ :Let :param (?X ?Y) .
+ ?X math:notGreaterThan ?Y .
}
=>
{
- :result :is ?Y .
+ :result :is true .
} .
```
@@ -2744,37 +2706,41 @@ Parse the string ':Socrates a :Human .' as N3.
```
@prefix : .
-:result :is { a . } .
+:result :is true .
```
-### log:rawType ### {#log:rawType}
-Gets the type of the N3 resource.
+### math:notLessThan ### {#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 the N3 resource type of `$s` is `$o`.
-N3 resource types include `log:Formula`, `log:Literal`, `rdf:List` or `log:Other`.
+`true` if and only if `$s` is a number that is not less than `$o`.
-**Schema**
`$s+ log:rawType $o-`
+**See also**
math:lessThan
+
+**Schema**
`$s+ math:notLessThan $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Get the type of lists and graph terms.
+Check if 42 is not less than 41 .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param (42 41) .
{
- (1 2 3 4) log:rawType ?listType .
- { :s :p :o } log:rawType ?graphType .
-}
+ :Let :param (?X ?Y) .
+ ?X math:notLessThan ?Y .
+}
=>
{
- :result :is ( ?listType ?graphType ) .
+ :result :is true .
} .
```
@@ -2782,30 +2748,38 @@ Get the type of lists and graph terms.
```
@prefix : .
-@prefix rdf: .
-@prefix log: .
-:result :is ( rdf:List log:Formula ) .
+:result :is true .
```
-
-
try in editor 🚀
+
+### math:product ### {#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 editor 🚀
-Get the type of resources.
+Calculate the product of 2,4,6, and 8 .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param (2 4 6 8) .
{
- log:rawType ?resourceType .
+ :Let :param ?param .
+ ?param math:product ?result .
}
=>
{
- :result :is ?resourceType .
+ :result :is ?result .
} .
```
@@ -2813,32 +2787,31 @@ Get the type of resources.
```
@prefix : .
-@prefix log: .
-:result :is log:Other.
+:result :is 384.
```
-
try in editor 🚀
+
try in editor 🚀
-Get the type of literal resources.
+Calculate the product of 2 and 21.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+
+:Let :param (2 21) .
{
- "Hello" log:rawType ?stringType .
- 42 log:rawType ?integerType .
- true log:rawType ?trueType .
- false log:rawType ?falseType .
+ :Let :param ?param .
+ ?param math:product ?result .
}
=>
{
- :result :is ( ?stringType ?integerType ?trueType ?falseType ) .
+ :result :is ?result .
} .
```
@@ -2846,161 +2819,200 @@ Get the type of literal resources.
```
@prefix : .
-@prefix log: .
-:result :is ( log:Literal log:Literal log:Literal log:Literal ) .
+:result :is 42.
```
-### log:semantics ### {#log:semantics}
-Gets as object the graph term that results from parsing an online (N3) string, found by dereferencing the subject IRI.
+### math:quotient ### {#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 a graph term that results from parsing the string that results from dereferencing `$s`.
+`true` if and only if `$o` is the result of dividing `$s.1` by `$s.2`.
-**Schema**
`$s+ log:semantics $o?`
where:
`$s`: `log:Uri`
`$o`: `log:Formula`
+**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 editor 🚀
+
try in editor 🚀
-Read the contents of the file `` and parse it as Notation3.
-We assume `` contains the text:
-```
- @prefix : .
- :Socrates a :Human .
-```
+Calculate the quotient of 42 and 2.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-{ log:semantics ?semantics . } => { :result :is ?semantics } .
+:Let :param (42 2) .
+
+{
+ :Let :param ?param .
+ ?param math:quotient ?result .
+}
+=>
+{
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-:result :is { :Socrates a :Human . } .
+:result :is 21.
```
-### log:semanticsOrError ### {#log:semanticsOrError}
-Either gets as object the graph term that results from parsing an online (N3) string, found by dereferencing the subject IRI; or an error message that explains what went wrong.
+### math:remainder ### {#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 (a) `$o` is a graph term that results from parsing the string that results from dereferencing `$s`; or (b) an error message explaining what went wrong.
+`true` if and only if `$o` is the remainder of dividing `$s.1` by `$s.2`.
-**Schema**
`$s+ log:semanticsOrError $o?`
where:
`$s`: `log:Uri`
`$o`: (either a log:Formula or xsd:string)
+**Schema**
`( $s.1+ $s.2+ )+ math:remainder $o-`
where:
`$s.1`: `xsd:integer`, `$s.2`: `xsd:integer`
`$o`: `xsd:integer`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Read the contents a non existing `` and parse it as Notation3 (which of course will fail).
+Calculate the remainder of 10 divided by 3.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
-{ log:semanticsOrError ?semantics } => { :result :is ?semantics } .
+:Let :param (10 3) .
+
+{
+ :Let :param ?param .
+ ?param math:remainder ?result .
+}
+=>
+{
+ :result :is ?result .
+} .
+
```
Result:
```
@prefix : .
-
-:result :is "error(existence_error(source_sink,/error.data),context(system:open/4,No such file or directory))" .
+:result :is 1.
```
-### log:skolem ### {#log:skolem}
-Gets as object a skolem IRI that is a function of the subject (commonly a list) and a concrete reasoning run (implicit); for one reasoning run, the same subject will always result in the same skolem IRI.
+### math:rounded ### {#math:rounded}
+Calculates the object as the integer that is closest to the subject number.
-`true` if and only if `$o` is a skolem IRI that is produced by applying a skolem function to the subject.
+`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+ log:skolem $o-`
+
+**Schema**
`$s+ math:rounded $o-`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: `xsd:integer`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Generate a unique Skolem IRI from the list (:abc 77 "xyz") .
+Calculate the rounded version of 3.3.
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+@prefix xsd: .
-{ (:abc 77 "xyz") log:skolem ?skolem . } => { :result :is ?skolem } .
+:Let :param "3.3"^^xsd:double .
+
+{
+ :Let :param ?param .
+ ?param math:rounded ?result .
+}
+=>
+{
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-:result :is .
+:result :is 3.
```
-### log:uri ### {#log:uri}
-Gets as object the string representation of the subject URI.
+### math:sin ### {#math:sin}
+Calculates the object as the sine value of the subject.
-`true` if and only if `$o` is the string representation of `$s`.
+`true` if and only if `$o` is the sine value of `$s`.
-**Schema**
`$s? log:uri $o?`
where:
`$s`: (a URI)
`$o`: `xsd:string`
+**See also**
math:asinmath:sinh
+
+**Schema**
`$s? math:sin $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Parse the URI into a string .
+Calculate the sin of pi/2 (1.57079632679) .
Formula:
```
@prefix : .
-@prefix log: .
+@prefix math: .
+@prefix xsd: .
-{ log:uri ?uri . } => { :result :is ?uri . } .
+:Let :param "1.57079632679"^^xsd:double .
+
+{
+ :Let :param ?param .
+ ?param math:sin ?result .
+}
+=>
+{
+ :result :is ?result .
+} .
```
Result:
```
@prefix : .
-:result :is "https://www.w3.org" .
+@prefix xsd: .
+:result :is "1.0"^^xsd:double .
```
-## math ## {#math}
-### math:absoluteValue ### {#math:absoluteValue}
-Calculates as object the absolute value of the subject.
+### math:sinh ### {#math:sinh}
+Calculates the object as the hyperbolic sine value of the subject.
-`true` if and only if `$o` is the absolute value of `$s`.
+`true` if and only if `$o` is the hyperbolic sine value of `$s`.
-**Schema**
`$s+ math:absoluteValue $o-`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**See also**
math:sinmath:asin
+
+**Schema**
`$s? math:sinh $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the absolute value of the value -2.
+Calculate the sinh of log(1 + sqrt(2)) (0.88137358701954302).
Formula:
```
@prefix : .
@prefix math: .
+@prefix xsd: .
-:Let :param -2 .
+:Let :param "0.88137358701954302"^^xsd:double.
{
:Let :param ?param .
- ?param math:absoluteValue ?result .
+ ?param math:sinh ?result .
}
=>
{
@@ -3012,24 +3024,22 @@ Calculate the absolute value of the value -2.
```
@prefix : .
-:result :is 2.
+:result :is 1.0.
```
-### math:acos ### {#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`.
+### math:sum ### {#math:sum}
+Calculates the object as the sum of the numbers given in the subject list.
-**See also**
math:cosmath:cosh
+`true` if and only if `$o` is the arithmetic sum of all numbers `$s.i`
-**Schema**
`$s? math:acos $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**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 editor 🚀
+
try in editor 🚀
-Calculate the arc cosine of the value 1.
+Calculate the sum of 1,2,3,4,5,6,7,8,9,10.
Formula:
```
@@ -3037,11 +3047,11 @@ Calculate the arc cosine of the value 1.
@prefix : .
@prefix math: .
-:Let :param 1 .
+:Let :param (1 2 3 4 5 6 7 8 9 10) .
{
:Let :param ?param .
- ?param math:acos ?result .
+ ?param math:sum ?result .
}
=>
{
@@ -3053,36 +3063,37 @@ Calculate the arc cosine of the value 1.
```
@prefix : .
-:result :is 0.0 .
+:result :is 55.
```
-### math:asin ### {#math:asin}
-Calculates the object as the arc sine value of the subject.
+### math:tan ### {#math:tan}
+Calculates the object as the tangent value of the subject.
-`true` if and only if `$o` is the arc sine value of `$s`.
+`true` if and only if `$o` is the tangent value of `$s`.
-**See also**
math:sinhmath:sin
+**See also**
math:tanhmath:atan
-**Schema**
`$s? math:asin $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s? math:tan $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the arc sine of the value 1.
+Calculate the tangent of the value 0.7853981633974483 .
Formula:
```
@prefix : .
@prefix math: .
+@prefix xsd: .
-:Let :param 1 .
+:Let :param "0.7853981633974483"^^xsd:double .
{
:Let :param ?param .
- ?param math:asin ?result .
+ ?param math:tan ?result .
}
=>
{
@@ -3094,36 +3105,38 @@ Calculate the arc sine of the value 1.
```
@prefix : .
-:result :is 1.5707963267948966 .
+@prefix xsd: .
+:result :is "0.9999999999999999"^^xsd:double.
```
-### math:atan ### {#math:atan}
-Calculates the object as the arc tangent value of the subject.
+### math:tanh ### {#math:tanh}
+Calculates the object as the hyperbolic tangent value of the subject.
-`true` if and only if `$o` is the arc tangent value of `$s`.
+`true` if and only if `$o` is the hyperbolic tangent value of `$s`.
-**See also**
math:tanmath:tanh
+**See also**
math:atanmath:tan
-**Schema**
`$s? math:atan $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s? math:tanh $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the arc tangent of the value 1.
+Calculate the hyperbolic tanget of 0.549306 .
Formula:
```
@prefix : .
@prefix math: .
+@prefix xsd: .
-:Let :param 1 .
+:Let :param "0.549306"^^xsd:double .
{
:Let :param ?param .
- ?param math:atan ?result .
+ ?param math:tanh ?result .
}
=>
{
@@ -3135,36 +3148,36 @@ Calculate the arc tangent of the value 1.
```
@prefix : .
-:result :is 0.7853981633974483 .
+@prefix xsd: .
+:result :is "0.49999989174945103"^^xsd:double.
```
-### math:cos ### {#math:cos}
-Calculates the object as the cosine value of the subject.
-
-`true` if and only if `$o` is the cosine value of `$s`.
+## string ## {#string}
+### string:concatenation ### {#string:concatenation}
+Concatenates the strings from the subject list into a single string as object.
-**See also**
math:acosmath:cosh
+`true` if and only if the string concatenation of `$s.i` equals `$o`.
-**Schema**
`$s? math:cos $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`( $s.i+ )+ string:concatenation $o-`
where:
`$s.i`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the cosine of the value 0.
+Concatenates the string "hello", " " and "world!".
Formula:
```
@prefix : .
-@prefix math: .
+@prefix string: .
-:Let :param 0 .
+:Let :param ( "hello" " " "world!" ) .
{
:Let :param ?param .
- ?param math:cos ?result .
+ ?param string:concatenation ?result .
}
=>
{
@@ -3176,40 +3189,41 @@ Calculate the cosine of the value 0.
```
@prefix : .
-:result :is 1.0 .
+:result :is "hello world!".
```
-### math:cosh ### {#math:cosh}
-Calculates the object as the hyperbolic cosine value of the subject.
+### string:contains ### {#string:contains}
+Checks whether the subject string contains the object string.
-`true` if and only if `$o` is the hyperbolic cosine value of `$s`.
+`true` if and only if `$s` contains `$o`.
-**See also**
math:acosmath:cos
+**See also**
string:containsIgnoringCase
-**Schema**
`$s? math:cosh $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ string:contains $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the hyperbolic cosine of the value 0.
+Checks whether the string "hello world!" contains the string "llo worl".
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param 0 .
+@prefix string: .
+:Let :param1 "hello world!" .
+:Let :param2 "llo worl".
{
- :Let :param ?param .
- ?param math:cosh ?result .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:contains ?param2 .
}
=>
{
- :result :is ?result .
+ :result :is true .
} .
```
@@ -3217,38 +3231,41 @@ Calculate the hyperbolic cosine of the value 0.
```
@prefix : .
-:result :is 1.0 .
+:result :is true .
```
-### math:degrees ### {#math:degrees}
-Calculates the object as the value in degrees corresponding to the radians value of the subject.
+### string:containsIgnoringCase ### {#string:containsIgnoringCase}
+Checks whether the subject string contains the object string, ignoring differences between lowercase and uppercase.
-`true` if and only if `$o` is the value in degrees corresponding to the radians value of `$s`.
+`true` if and only if `$s` contains `$o` when ignoring case differences.
-**Schema**
`$s? math:degrees $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**See also**
string:contains
+
+**Schema**
`$s+ string:containsIgnoringCase $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the degrees of the radians value 1.57079632679.
+Checks whether the string "hello world!" contains the string "lLO woRl".
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param 1.57079632679 .
+@prefix string: .
+:Let :param1 "hello world!" .
+:Let :param2 "lLO woRl".
{
- :Let :param ?param .
- ?param math:degrees ?result .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:containsIgnoringCase ?param2 .
}
=>
{
- :result :is ?result .
+ :result :is true .
} .
```
@@ -3256,38 +3273,39 @@ Calculate the degrees of the radians value 1.57079632679.
```
@prefix : .
-:result :is 89.99999999971946 .
+:result :is true .
```
-### math:difference ### {#math:difference}
-Calculates the object by subtracting the second number from the first number given in the subject list.
+### string:endsWith ### {#string:endsWith}
+Checks whether the subject string ends with the object string.
-`true` if and only if `$o` is the result of subtracting `$s.2` from `$s.1`.
+`true` if and only if `$s` ends with `$o`.
-**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`)
+**Schema**
`$s+ string:endsWith $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the value of 7 minus 2.
+Checks whether the string "hello world!" ends with "orld!".
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (7 2) .
+@prefix string: .
+:Let :param1 "hello world!" .
+:Let :param2 "orld!".
{
- :Let :param ?param .
- ?param math:difference ?result .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:endsWith ?param2 .
}
=>
{
- :result :is ?result .
+ :result :is true .
} .
```
@@ -3295,36 +3313,35 @@ Calculate the value of 7 minus 2.
```
@prefix : .
-:result :is 5.
+:result :is true .
```
-### math:equalTo ### {#math:equalTo}
-Checks whether the subject and object are the same number.
-
-`true` if and only if `$s` is the same number as `$o`.
+### string:equalIgnoringCase ### {#string:equalIgnoringCase}
+Checks whether the subject string is the same as the object string, ignoring differences between lowercase and uppercase.
-**See also**
math:notEqualTo
+`true` if and only if `$s` is the same string as `$o` when ignoring case differences.
-**Schema**
`$s? math:equalTo $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ string:equalIgnoringCase $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Check if the numbers 42 and 42 are equal .
+Checks whether the string "hello world!" is equal to "hELLo wORld!" ignoring the case .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (42 42) .
+@prefix string: .
+:Let :param1 "hello world!" .
+:Let :param2 "hELLo wORld!" .
{
- :Let :param (?X ?Y) .
- ?X math:equalTo ?Y .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:equalIgnoringCase ?param2 .
}
=>
{
@@ -3342,26 +3359,29 @@ Check if the numbers 42 and 42 are equal .
-### math:exponentiation ### {#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).
+### string:format ### {#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 raising `$s.1` to the power of `$s.2`
+`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.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`)
+**Schema**
`( $s.i+ )+ string:format $o-`
where:
`$s.i`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the logarithm of 49 base 2 .
+Calculate the result of applying the format "%s://%s/%s" to the strings "https", "w3c.github.io" and "N3/spec" .
Formula:
```
@prefix : .
-@prefix math: .
+@prefix string: .
+
+:Let :param ( "%s://%s/%s" "https" "w3c.github.io" "N3/spec/" ) .
{
- (7 ?result) math:exponentiation 49 .
+ :Let :param ?param .
+ ?param string:format ?result .
}
=>
{
@@ -3373,31 +3393,41 @@ Calculate the logarithm of 49 base 2 .
```
@prefix : .
-:result :is 2.0 .
+:result :is "https://w3c.github.io/N3/spec/".
```
-
-
try in editor 🚀
+
+### string:greaterThan ### {#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.
+
+**See also**
string:notGreaterThan
+
+**Schema**
`$s+ string:greaterThan $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
+**Examples**
+
try in editor 🚀
-Calculate the value of 7 raised to the power of 2 .
+Checks whether the string "Pengiun" is greater than the string "Cat" .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (7 2) .
+@prefix string: .
+:Let :param1 "Penguin" .
+:Let :param2 "Cat".
{
- :Let :param ?param .
- ?param math:exponentiation ?result .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:greaterThan ?param2 .
}
=>
{
- :result :is ?result .
+ :result :is true .
} .
```
@@ -3405,36 +3435,37 @@ Calculate the value of 7 raised to the power of 2 .
```
@prefix : .
-:result :is 49 .
+:result :is true .
```
-### math:greaterThan ### {#math:greaterThan}
-Checks whether the subject is a number that is greater than the object.
+### string:lessThan ### {#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 a number that is greater than `$o`.
+`true` if and only if `$s` is less than `$o` as per the Unicode code order.
-**See also**
math:notGreaterThan
+**See also**
string:notLessThan
-**Schema**
`$s+ math:greaterThan $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ string:lessThan $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Check if 42 is greater than 41 .
+Checks whether the string "Cat" is less than the string "Penguin" .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (42 41) .
+@prefix string: .
+:Let :param1 "Cat" .
+:Let :param2 "Penguin".
{
- :Let :param (?X ?Y) .
- ?X math:greaterThan ?Y .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:lessThan ?param2 .
}
=>
{
@@ -3446,36 +3477,38 @@ Check if 42 is greater than 41 .
```
@prefix : .
-:result :is true .
+:result :is true .
```
-### math:lessThan ### {#math:lessThan}
-Checks whether the subject is a number that is less than the object.
+### string:matches ### {#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 `$s` is a number that is less than `$o`.
+`true` if and only if string `$s` matches the regular expression `$o`
-**See also**
math:notLessThan
+**See also**
string:notMatches
-**Schema**
`$s+ math:lessThan $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ string:matches $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Check if 41 is less than 42 .
+Checks whether the string "hello world!" matches the regular expression ".*(l)+o wo.*".
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (41 42) .
+@prefix string: .
+:Let :param1 "hello world!" .
+:Let :param2 ".*(l)+o wo.*".
{
- :Let :param (?X ?Y) .
- ?X math:lessThan ?Y .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:matches ?param2 .
}
=>
{
@@ -3487,38 +3520,39 @@ Check if 41 is less than 42 .
```
@prefix : .
-:result :is true .
+:result :is true .
```
-### math:negation ### {#math:negation}
-Calculates the object as the negation of the subject.
+### string:notEqualIgnoringCase ### {#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 `$o` is the negation of `$s`.
+`true` if and only if `$s` is not the same string as `$o` when ignoring case differences.
-**Schema**
`$s? math:negation $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ string:notEqualIgnoringCase $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the negation of the value 42 .
+Checks whether the string "hello world!" is not equal to "hELLo dunia!" ignorning the case .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param 42 .
+@prefix string: .
+:Let :param1 "hello world!" .
+:Let :param2 "hELLo dunia!" .
{
- :Let :param ?param .
- ?param math:negation ?result .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:notEqualIgnoringCase ?param2 .
}
=>
{
- :result :is ?result .
+ :result :is true .
} .
```
@@ -3526,36 +3560,38 @@ Calculate the negation of the value 42 .
```
@prefix : .
-:result :is -42 .
+:result :is true .
```
-### math:notEqualTo ### {#math:notEqualTo}
-Checks whether the subject and object are not the same number.
+### string:notGreaterThan ### {#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 the not same number as `$o`.
+`true` if and only if `$s` is not greater than `$o` as per the Unicode code order.
-**See also**
math:equalTo
+**See also**
string:greaterThan
-**Schema**
`$s+ math:notEqualTo $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ string:notGreaterThan $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Check if the numbers 41 and 42 are not equal .
+Checks whether the string "Cat" is not greater than the string "Penguin" .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (41 42) .
+@prefix string: .
+:Let :param1 "Cat" .
+:Let :param2 "Penguin".
{
- :Let :param (?X ?Y) .
- ?X math:notEqualTo ?Y .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:notGreaterThan ?param2 .
}
=>
{
@@ -3567,37 +3603,38 @@ Check if the numbers 41 and 42 are not equal .
```
@prefix : .
-:result :is true .
+:result :is true .
```
-### math:notGreaterThan ### {#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.
+### string:notLessThan ### {#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 a number that is not greater than `$o`.
+`true` if and only if `$s` is not less than `$o` as per the Unicode code order.
-**See also**
math:greaterThan
+**See also**
string:lessThan
-**Schema**
`$s+ math:notGreaterThan $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ string:notLessThan $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Check if 41 is not greater than 42 .
+Checks whether the string "Penguin" is not less than the string "Cat" .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (41 42) .
+@prefix string: .
+:Let :param1 "Penguin".
+:Let :param2 "Cat" .
{
- :Let :param (?X ?Y) .
- ?X math:notGreaterThan ?Y .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:notLessThan ?param2 .
}
=>
{
@@ -3609,37 +3646,38 @@ Check if 41 is not greater than 42 .
```
@prefix : .
-:result :is true .
+:result :is true .
```
-### math:notLessThan ### {#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.
+### string:notMatches ### {#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 `$s` is a number that is not less than `$o`.
+`true` if and only if string `$s` does not match the regular expression `$o`
-**See also**
math:lessThan
+**See also**
string:matches
-**Schema**
`$s+ math:notLessThan $o+`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ string:notMatches $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Check if 42 is not less than 41 .
+Checks whether the string "hello world!" no matches the regular expression ".*(l)+o dunia.*".
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (42 41) .
+@prefix string: .
+:Let :param1 "hello world!" .
+:Let :param2 ".*(l)+o dunia.*".
{
- :Let :param (?X ?Y) .
- ?X math:notLessThan ?Y .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:notMatches ?param2 .
}
=>
{
@@ -3651,34 +3689,37 @@ Check if 42 is not less than 41 .
```
@prefix : .
-:result :is true .
+:result :is true .
```
-### math:product ### {#math:product}
-Calculates the object as the product of the numbers given in the subject list.
+### string:replace ### {#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 arithmetic product of all numbers `$s.i`
+`true` if and only if `$o` is the result of replacing all occurrences of `$s.2` in `$s.1` with `$s.3`
-**Schema**
`( $s.i+ )+ math:product $o-`
where:
`$s.i`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**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 editor 🚀
+
try in editor 🚀
-Calculate the product of 2,4,6, and 8 .
+Replace all "l"-s in the string "hello world!" with the bracket version "[l]" .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (2 4 6 8) .
+@prefix string: .
+:Let :data "hello world!" .
+:Let :search "(l)" .
+:Let :replace "[$1]" .
{
- :Let :param ?param .
- ?param math:product ?result .
+ :Let :data ?data .
+ :Let :search ?search .
+ :Let :replace ?replace .
+ (?data ?search ?replace) string:replace ?result .
}
=>
{
@@ -3690,27 +3731,35 @@ Calculate the product of 2,4,6, and 8 .
```
@prefix : .
-:result :is 384.
+:result :is "he[l][l]o wor[l]d!".
```
-
-
try in editor 🚀
+
+### string:scrape ### {#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`
`$o`: `xsd:string`
+**Examples**
+
try in editor 🚀
-Calculate the product of 2 and 21.
+Extract from the string "https://w3c.github.io/N3/spec/" the last path element using a regular expression .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (2 21) .
+@prefix string: .
+:Let :param1 "https://w3c.github.io/N3/spec/" .
+:Let :param2 ".*/([^/]+/)$" .
{
- :Let :param ?param .
- ?param math:product ?result .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ (?param1 ?param2) string:scrape ?result .
}
=>
{
@@ -3722,38 +3771,39 @@ Calculate the product of 2 and 21.
```
@prefix : .
-:result :is 42.
+:result :is "spec/".
```
-### math:quotient ### {#math:quotient}
-Calculates the object by dividing the first number by the second number given in the subject list.
+### string:startsWith ### {#string:startsWith}
+Checks whether the subject string starts with the object string.
-`true` if and only if `$o` is the result of dividing `$s.1` by `$s.2`.
+`true` if and only if `$s` starts with `$o`.
-**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`)
+**Schema**
`$s+ string:startsWith $o+`
where:
`$s`: `xsd:string`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the quotient of 42 and 2.
+Checks whether the string "hello world!" starts with "hello" .
Formula:
```
@prefix : .
-@prefix math: .
-
-:Let :param (42 2) .
+@prefix string: .
+:Let :param1 "hello world!" .
+:Let :param2 "hello".
{
- :Let :param ?param .
- ?param math:quotient ?result .
+ :Let :param1 ?param1 .
+ :Let :param2 ?param2 .
+ ?param1 string:startsWith ?param2 .
}
=>
{
- :result :is ?result .
+ :result :is true .
} .
```
@@ -3761,34 +3811,36 @@ Calculate the quotient of 42 and 2.
```
@prefix : .
-:result :is 21.
+:result :is true .
```
-### math:remainder ### {#math:remainder}
-Calculates the object as the remainder of the division of the first integer by the second integer given in the subject list.
+## time ## {#time}
+### time:day ### {#time:day}
+Gets as object the integer day component of the subject xsd:dateTime.
-`true` if and only if `$o` is the remainder of dividing `$s.1` by `$s.2`.
+`true` if and only if `$o` is the integer day component of `$s`.
-**Schema**
`( $s.1+ $s.2+ )+ math:remainder $o-`
where:
`$s.1`: `xsd:integer`, `$s.2`: `xsd:integer`
`$o`: `xsd:integer`
+**Schema**
`$s+ time:day $o-`
where:
`$s`: `xsd:dateTime`
`$o`: `xsd:integer`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the remainder of 10 divided by 3.
+Return the day component of the date "2023-04-01T18:06:04Z" .
Formula:
```
@prefix : .
-@prefix math: .
+@prefix xsd: .
+@prefix time: .
-:Let :param (10 3) .
+:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .
{
:Let :param ?param .
- ?param math:remainder ?result .
+ ?param time:day ?result .
}
=>
{
@@ -3800,37 +3852,35 @@ Calculate the remainder of 10 divided by 3.
```
@prefix : .
-:result :is 1.
+:result :is 1.
```
-### math:rounded ### {#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.
+### time:hour ### {#time:hour}
+Gets as object the integer hour component of the subject xsd:dateTime.
+`true` if and only if `$o` is the integer hour component of `$s`.
-**Schema**
`$s+ math:rounded $o-`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: `xsd:integer`
+**Schema**
`$s+ time:hour $o-`
where:
`$s`: `xsd:dateTime`
`$o`: `xsd:integer`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the rounded version of 3.3.
+Return the hour component of the date "2023-04-01T18:06:04Z" .
Formula:
```
@prefix : .
-@prefix math: .
-@prefix xsd: .
+@prefix xsd: .
+@prefix time: .
-:Let :param "3.3"^^xsd:double .
+:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .
{
:Let :param ?param .
- ?param math:rounded ?result .
+ ?param time:hour ?result .
}
=>
{
@@ -3842,37 +3892,35 @@ Calculate the rounded version of 3.3.
```
@prefix : .
-:result :is 3.
+:result :is 18.
```
-### math:sin ### {#math:sin}
-Calculates the object as the sine value of the subject.
-
-`true` if and only if `$o` is the sine value of `$s`.
+### time:minute ### {#time:minute}
+Gets as object the integer minutes component of the subject xsd:dateTime.
-**See also**
math:sinhmath:asin
+`true` if and only if `$o` is the integer minutes component of `$s`.
-**Schema**
`$s? math:sin $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ time:minute $o-`
where:
`$s`: `xsd:dateTime`
`$o`: `xsd:integer`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the sin of pi/2 (1.57079632679) .
+Return the minute component of the date "2023-04-01T18:06:04Z" .
Formula:
```
@prefix : .
-@prefix math: .
-@prefix xsd: .
+@prefix xsd: .
+@prefix time: .
-:Let :param "1.57079632679"^^xsd:double .
+:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .
{
:Let :param ?param .
- ?param math:sin ?result .
+ ?param time:minute ?result .
}
=>
{
@@ -3884,38 +3932,35 @@ Calculate the sin of pi/2 (1.57079632679) .
```
@prefix : .
-@prefix xsd: .
-:result :is "1.0"^^xsd:double .
+:result :is 6.
```
-### math:sinh ### {#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`.
+### time:month ### {#time:month}
+Gets as object the integer month component of the subject xsd:dateTime.
-**See also**
math:sinmath:asin
+`true` if and only if `$o` is the integer month component of `$s`.
-**Schema**
`$s? math:sinh $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ time:month $o-`
where:
`$s`: `xsd:dateTime`
`$o`: `xsd:integer`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the sinh of log(1 + sqrt(2)) (0.88137358701954302).
+Return the month component of the date "2023-04-01T18:06:04Z" .
Formula:
```
@prefix : .
-@prefix math: .
-@prefix xsd: .
+@prefix xsd: .
+@prefix time: .
-:Let :param "0.88137358701954302"^^xsd:double.
+:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .
{
:Let :param ?param .
- ?param math:sinh ?result .
+ ?param time:month ?result .
}
=>
{
@@ -3927,34 +3972,35 @@ Calculate the sinh of log(1 + sqrt(2)) (0.88137358701954302).
```
@prefix : .
-:result :is 1.0.
+:result :is 4.
```
-### math:sum ### {#math:sum}
-Calculates the object as the sum of the numbers given in the subject list.
+### time:second ### {#time:second}
+Gets as object the integer seconds component of the subject xsd:dateTime.
-`true` if and only if `$o` is the arithmetic sum of all numbers `$s.i`
+`true` if and only if `$o` is the integer seconds component of `$s`.
-**Schema**
`( $s.i+ )+ math:sum $o-`
where:
`$s.i`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ time:second $o-`
where:
`$s`: `xsd:dateTime`
`$o`: `xsd:integer`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the sum of 1,2,3,4,5,6,7,8,9,10.
+Return the seconds component of the date "2023-04-01T18:06:04Z" .
Formula:
```
@prefix : .
-@prefix math: .
+@prefix xsd: .
+@prefix time: .
-:Let :param (1 2 3 4 5 6 7 8 9 10) .
+:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .
{
:Let :param ?param .
- ?param math:sum ?result .
+ ?param time:second ?result .
}
=>
{
@@ -3966,37 +4012,35 @@ Calculate the sum of 1,2,3,4,5,6,7,8,9,10.
```
@prefix : .
-:result :is 55.
+:result :is 4.
```
-### math:tan ### {#math:tan}
-Calculates the object as the tangent value of the subject.
-
-`true` if and only if `$o` is the tangent value of `$s`.
+### time:timeZone ### {#time:timeZone}
+Gets as object the trailing timezone offset of the subject xsd:dateTime (e.g., "-05:00").
-**See also**
math:atanmath:tanh
+`true` if and only if `$o` is the timezone offset of `$s`.
-**Schema**
`$s? math:tan $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ time:timeZone $o-`
where:
`$s`: `xsd:dateTime`
`$o`: `xsd:string`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the tangent of the value 0.7853981633974483 .
+Return the time zone component of the date "2023-04-01T18:06:04Z" .
Formula:
```
@prefix : .
-@prefix math: .
-@prefix xsd: .
+@prefix xsd: .
+@prefix time: .
-:Let :param "0.7853981633974483"^^xsd:double .
+:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .
{
:Let :param ?param .
- ?param math:tan ?result .
+ ?param time:minute ?result .
}
=>
{
@@ -4008,38 +4052,35 @@ Calculate the tangent of the value 0.7853981633974483 .
```
@prefix : .
-@prefix xsd: .
-:result :is "0.9999999999999999"^^xsd:double.
+:result :is "Z".
```
-### math:tanh ### {#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`.
+### time:year ### {#time:year}
+Gets as object the integer year component of the subject xsd:dateTime.
-**See also**
math:tanmath:atan
+`true` if and only if `$o` is the integer year component of `$s`.
-**Schema**
`$s? math:tanh $o?`
where:
`$s`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
`$o`: (`xsd:decimal` | `xsd:double` | `xsd:float`)
+**Schema**
`$s+ time:year $o-`
where:
`$s`: `xsd:dateTime`
`$o`: `xsd:integer`
**Examples**
-
try in editor 🚀
+
try in editor 🚀
-Calculate the hyperbolic tanget of 0.549306 .
+Return the minute component of the date "2023-04-01T18:06:04Z" .
Formula:
```
@prefix : .
-@prefix math: .
-@prefix xsd: .
+@prefix xsd: .
+@prefix time: .
-:Let :param "0.549306"^^xsd:double .
+:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .
{
:Let :param ?param .
- ?param math:tanh ?result .
+ ?param time:year ?result .
}
=>
{
@@ -4051,8 +4092,7 @@ Calculate the hyperbolic tanget of 0.549306 .
```
@prefix : .
-@prefix xsd: .
-:result :is "0.49999989174945103"^^xsd:double.
+:result :is 2023.
```
diff --git a/spec/src/time/hour.n3 b/spec/src/time/hour.n3
new file mode 100644
index 0000000..aef40a5
--- /dev/null
+++ b/spec/src/time/hour.n3
@@ -0,0 +1,56 @@
+@prefix fnon:
.
+@prefix time: .
+@prefix log: .
+@prefix dcterms: .
+@prefix fno: .
+@prefix rdf: .
+@prefix rdfs: .
+@prefix vs: .
+@prefix xsd: .
+
+time:hour a fno:Function ;
+ vs:term_status "testing" ;
+ fnon:tldr "Gets as object the integer hour component of the subject xsd:dateTime." ;
+ dcterms:comment """`true` if and only if `$o` is the integer hour component of `$s`.""" ;
+ fno:example (
+ [ a fno:Test , fno:TestSkip ;
+ dcterms:description """
+Return the hour component of the date "2023-04-01T18:06:04Z" .
+ """ ;
+ rdfs:seeAlso <> ;
+ fno:expression """
+@prefix : .
+@prefix xsd: .
+@prefix time: .
+
+:Let :param "2023-04-01T18:06:04Z"^^xsd:dateTime .
+
+{
+ :Let :param ?param .
+ ?param time:hour ?result .
+}
+=>
+{
+ :result :is ?result .
+} .
+ """ ;
+ fno:result """
+@prefix : .
+:result :is 18.
+ """
+ ]
+ ) ;
+ fno:name "hour" ;
+ fno:parameter ( [
+ a fno:Parameter ;
+ fno:predicate "$s" ;
+ fno:mode "+" ;
+ fnon:position fnon:subject ;
+ fno:type xsd:dateTime
+ ] [
+ a fno:Parameter ;
+ fno:predicate "$o" ;
+ fno:mode "-" ;
+ fnon:position fnon:object ;
+ fno:type xsd:integer
+ ] ) .