You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Internally, Nemo treats all of these as IRIs. Prefixed names are expanded by concatenating prefix and local name (so `wikidata:Q1172264` would be another way of writing `<http://www.wikidata.org/entity/Q1172264>`, and simple string names are interpreted as *relative* IRIs (so `alice` would be another way of writing `<alice>`). You can write your predicate names and constants as you prefer, or use own prefixes as a mere way of adding some "namespaces" to your identifiers.
92
+
Internally, Nemo treats all of these as IRIs. Prefixed names are expanded by concatenating prefix and local name (so `wikidata:Q1172264` would be another way of writing `<http://www.wikidata.org/entity/Q1172264>`), and simple string names are interpreted as *relative* IRIs (so `alice` would be another way of writing `<alice>`). You can write your predicate names and constants as you prefer, or use own prefixes as a mere way of adding some "namespaces" to your identifiers.
93
+
If you want to use a default prefix for all non-absolute predicate names and non-absolute literals, use the `@base` notation:
94
+
```
95
+
@base <http://www.wikidata.org/entity/>.
96
+
animal("dog","cat").
97
+
<test>(<mouse>,<turtle>).
98
+
```
99
+
In the example above, the first fact will be expanded to `http://www.wikidata.org/entity/animal("http://www.wikidata.org/entity/dog","http://www.wikidata.org/entity/cat")`, while the second fact remains `test(mouse, turtle)` because both the predicate name and literals are absolute.
Copy file name to clipboardExpand all lines: src/content/docs/reference/builtins.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,15 @@ title: Builtin Functions
6
6
### General-purpose functions
7
7
8
8
The following functions can be meaningfully used on data of arbitrary types:
9
-
-`DATATYPE` returns the datatype of the value. For IRIs (and constant), the type is reported as `http://www.w3.org/2001/XMLSchema#anyURI`. For language-tagged strings, the type is `http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`. As of Nemo v0.5.0, named nulls (blank nodes) have no defined type and `DATATYPE` does not return a valid result for such value. Moreover, the datatype is currently returned as a string, but will be an IRI in future versions ([#463](https://github.com/knowsys/nemo/issues/463)).
9
+
-`DATATYPE` returns the datatype of the value. For IRIs (and constant), the type is reported as `http://www.w3.org/2001/XMLSchema#anyURI`. For language-tagged strings, the type is `http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`. As of Nemo v0.5.0, named nulls (blank nodes) have no defined type and `DATATYPE` does not return a valid result for such value.
10
10
-`STR` returns the value as a string. For IRIs, this is the IRI string itself. For all other datatypes, this is the canonical form of the lexical value (without any datatype).
11
11
-`fullStr` returns the value as a string that is formatted as in RDF. Such stings would also be correct ways of writing the value in a Nemo rules file (though there might be shorter ways due to Nemo's abbreviations).
12
12
13
13
Further, it is possible to compare any values using `=` or `!=`.
14
14
15
15
### Functions for strings
16
16
17
-
Nemo supports the following functions on strings.
17
+
Nemo supports the following functions on plain strings and language tagged string. The behavior of the functions closely follows the [SPARQL recommendations](https://www.w3.org/TR/sparql11-query/#func-strings).
18
18
-`STRLEN`: computes the (integer) length of a string
19
19
-`UCASE` and `LCASE`: convert a string to upper case and lower case, respectively
20
20
-`CONCAT`: creates a new string by concatenating the input strings
A language-tagged string is a value like `"Hello world"@en`. The function `LANG` can be used to extract the language tag (`en` in the example), whereas `STR` can be used to obtain the lexical value (`"Hello world"`).
45
+
A language tagged string is a value like `"Hello world"@en`. The function `LANG` can be used to extract the language tag (`en` in the example), whereas `STR` can be used to obtain the lexical value (`"Hello world"`).
46
+
All [string functions](#functions-for-strings) can be used on language tagged strings.
47
+
Most importantly, binary functions return no result if the two language tags are not identical. For example, `CONTAINS("foo"@en, "foo"@gr)` will return no result. This behavior, including any edge cases are described in the [SPARQL recommendations](https://www.w3.org/TR/sparql11-query/#func-strings) in more detail.
0 commit comments