# URI() function accepts invalid IRIs

**URL:** <https://community.stardog.com/t/uri-function-accepts-invalid-iris/627>\
**Category:** Support\
**Created:** [October 2, 2017, 8:23am UTC](https://community.stardog.com/t/uri-function-accepts-invalid-iris/627 "2017-10-02T08:23:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![d.kontokostas](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@d.kontokostas](https://community.stardog.com/u/d.kontokostas)\
**Post date:** [October 2, 2017, 8:23am UTC](https://community.stardog.com/t/uri-function-accepts-invalid-iris/627/1 "2017-10-02T08:23:29Z")

</div>

Hello, I am using the URI function to construct some triples to insert in the DB with a SPARUL query like the following

```auto
insert { ?s ex:p ?o }
WHERE {
  ?s_old ex:p ?o .
  bind (uri('http://example.com/s') as ?s)
}

```

due to a software bug, the bind statement was filled with strings like

```auto
bind (uri('http://example.com/s>>') as ?s)

```

When I try to consume the data with Jena (both with SPARQL or NQ-exports) I get runtime exceptions from syntax errors like: `Illegal unicode excape sequence value: \> (0x3E)`

Question: is this the expected behavior for the `URI` function or should the above query fail?  
(or is it maybe a Jena parsing bug?)

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [October 2, 2017, 7:02pm UTC](https://community.stardog.com/t/uri-function-accepts-invalid-iris/627/2 "2017-10-02T19:02:56Z")

</div>

Something definitely seems off. It looks like `'http://example.com/s>>'` is getting converted to `http://example.com/s\>\>`

Interestingly it’s only (as far as I can tell) the ‘\>’ character that is escaped. `http://example.com/s<` stays the same as well as `'http://$*$@!%@#!%@$!#'`

‘strange’ is interpreted as a relative IRI and returns ‘tag:stardog:api:strange’ but`'$*$@!%@#!%@$!#'` is not changed or converted to a relative url but comes back as `'$*$@!%@#!%@$!#''`

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [October 16, 2017, 7:03pm UTC](https://community.stardog.com/t/uri-function-accepts-invalid-iris/627/3 "2017-10-16T19:03:13Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
