ADS filtering object (Datatype:datetime)

46 views
Skip to first unread message

Kasia Kryczka

unread,
Oct 16, 2023, 8:20:10 AM10/16/23
to TopBraid Suite Users
HI,

How can I filter the object to get for example a date older than 2 months from now ?
The triple looks as follows:

object  :05.07.2023 07:24


subject urn:x-change:2023-07-05T07-24-46.612example

Thanks,

Kasia

Holger Knublauch

unread,
Oct 16, 2023, 8:55:43 AM10/16/23
to topbrai...@googlegroups.com
let months = 2;
let maxTime = graph.eval(`NOW() - "P${months}M"^^xsd:duration`);
let changes = tbs.changes(null, maxTime);
changes;

The above works for the change history only. If you need a general solution, you can use a corresponding SPARQL expression such as

graph.eval('$value < $date', {
value: ... the object ...,
date: maxTime,
})

HTH
Holger


--
The topics of this mailing list include TopBraid EDG and related technologies such as SHACL.
To post to this group, send email to topbrai...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/0e126aa8-174b-4d5e-ac78-8b8fae7aacbdn%40googlegroups.com.

Kasia Kryczka

unread,
Oct 16, 2023, 9:22:04 AM10/16/23
to TopBraid Suite Users
Hi Holger,

many thanks for quick reply :)

I want for the the change history which will be later used for all collections.

with the first solution I got the following error : and I just 
Error: Cannot execute SELECT query SELECT ?change ?comment ?time ?userId ?addedCount ?deletedCount WHERE { ($about $maxTime $minTime $predicate $requiredUserId $committedOnly $unlimited $originWorkflowId $returnCounts) <http://topbraid.org/tbs#changes> (?change ?comment ?time ?userId ?addedCount ?deletedCount) }: java.lang.IllegalStateException: No TCH graph can be derived from the context

Br,

Kasia

Holger Knublauch

unread,
Oct 16, 2023, 10:34:27 AM10/16/23
to topbrai...@googlegroups.com
If you're getting an error executing tbs.changes, you're probably calling from within a graph.withDataGraph block? It should work fine if you're calling it in the context of any asset collection as active graph.

Holger


Kasia Kryczka

unread,
Oct 17, 2023, 4:30:18 AM10/17/23
to TopBraid Suite Users
Hi Holger,

I used graph.transaction, without that it worked just fine :)

Thanks,

Kasia
Reply all
Reply to author
Forward
0 new messages