[topbraid-users] Time Interval Functions
Hi. I have been trying to do some temporal arithmetic in SPARQL and have stumbled upon what I believe are time periods or time intervals. For example SELECT ?a ?aa WHERE { BIND ((08:15:00^^xsd:time - 10:15:00^^xsd:time) AS ?a) BIND ((2012-09-08T08:15:00^^xsd:dateTime - 2012-09-07T10:15:00^^xsd:dateTime) AS ?aa) } Results: ?a - -P0Y0M0DT2H0M0.000S (negative 2 hours) ?aa - P0Y0M0DT22H0M0.000S (positive 22 hours) My question: Is there any way to operate on these time periods? In particular, suppose I want to convert the length of these these periods into seconds or minutes. smf:duration does something similar, but it works on xsd:date values, and not time periods. If smf:duration took xsd:dateTime or xsd:time arguments, that would be helpful. Do you have any pointers to functions that extract information from these time periods? I suppose I can figure a way to do the arithmetic myself using days(), hours(), minutes() functions, but I would prefer to avoid that. Thanks, Rich Using TBC-SE 4.3.0 -- -- You received this message because you are subscribed to the Google Group TopBraid Suite Users, the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN. To post to this group, send email to topbraid-users@googlegroups.com To unsubscribe from this group, send email to topbraid-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/topbraid-users?hl=en --- 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-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [topbraid-users] Time Interval Functions
Rich, there are a number of SPARQL and TopBraid functions that work on xsd:time and xsd:dateTime for SPARQL, see http://www.w3.org/TR/sparql11-query/#func-date-time, including year(), month(), day(), hours(), timezone(), etc. TopBraid also has functions for duration, formatting date strings, etc. I.e. you can convert a dateTime string to a date string using dateFormat(). See TopBraid Composer Help TopBraid Composer Reference Functions Overview -- Scott On 2/11/2014, 10:40 AM, Rich Keller wrote: Hi. I have been trying to do some temporal arithmetic in SPARQL and have stumbled upon what I believe are time periods or time intervals. For example SELECT ?a ?aa WHERE { BIND (("08:15:00"^^xsd:time - "10:15:00"^^xsd:time) AS ?a) BIND (("2012-09-08T08:15:00"^^xsd:dateTime - "2012-09-07T10:15:00"^^xsd:dateTime) AS ?aa) } Results: ?a - -P0Y0M0DT2H0M0.000S (negative 2 hours) ?aa - P0Y0M0DT22H0M0.000S (positive 22 hours) My question: Is there any way to operate on these time periods? In particular, suppose I want to convert the length of these these periods into seconds or minutes. smf:duration does something similar, but it works on xsd:date values, and not time periods. If smf:duration took xsd:dateTime or xsd:time arguments, that would be helpful. Do you have any pointers to functions that extract information from these time periods? I suppose I can figure a way to do the arithmetic myself using days(), hours(), minutes() functions, but I would prefer to avoid that. Thanks, Rich Using TBC-SE 4.3.0 -- -- You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN. To post to this group, send email to topbraid-users@googlegroups.com To unsubscribe from this group, send email to topbraid-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/topbraid-users?hl=en --- 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-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Group TopBraid Suite Users, the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN. To post to this group, send email to topbraid-users@googlegroups.com To unsubscribe from this group, send email to topbraid-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/topbraid-users?hl=en --- 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-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [topbraid-users] Time Interval Functions
Scott: I'm aware of the SPARQL and TopBraid functions you mention. But to my knowledge, these functions do not operate on duration literals like P0Y0M0DT22H0M0.000S, which was returned by my query subtracting two xsd:time or xsd:dateTime literals (see original post). As I mentioned, smf:duration seems to take two xsd:date variables as input, which means it is not suitable for determining the duration between arbitrary times. Rich On Tuesday, February 11, 2014 9:39:40 AM UTC-8, Scott Henninger wrote: Rich, there are a number of SPARQL and TopBraid functions that work on xsd:time and xsd:dateTime for SPARQL, see http://www.w3.org/TR/sparql11-query/#func-date-time, including year(), month(), day(), hours(), timezone(), etc. TopBraid also has functions for duration, formatting date strings, etc. I.e. you can convert a dateTime string to a date string using dateFormat(). See TopBraid Composer Help TopBraid Composer Reference Functions Overview -- Scott On 2/11/2014, 10:40 AM, Rich Keller wrote: Hi. I have been trying to do some temporal arithmetic in SPARQL and have stumbled upon what I believe are time periods or time intervals. For example SELECT ?a ?aa WHERE { BIND ((08:15:00^^xsd:time - 10:15:00^^xsd:time) AS ?a) BIND ((2012-09-08T08:15:00^^xsd:dateTime - 2012-09-07T10:15:00^^xsd:dateTime) AS ?aa) } Results: ?a - -P0Y0M0DT2H0M0.000S (negative 2 hours) ?aa - P0Y0M0DT22H0M0.000S (positive 22 hours) My question: Is there any way to operate on these time periods? In particular, suppose I want to convert the length of these these periods into seconds or minutes. smf:duration does something similar, but it works on xsd:date values, and not time periods. If smf:duration took xsd:dateTime or xsd:time arguments, that would be helpful. Do you have any pointers to functions that extract information from these time periods? I suppose I can figure a way to do the arithmetic myself using days(), hours(), minutes() functions, but I would prefer to avoid that. Thanks, Rich Using TBC-SE 4.3.0 -- -- You received this message because you are subscribed to the Google Group TopBraid Suite Users, the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN. To post to this group, send email to topbrai...@googlegroups.com javascript: To unsubscribe from this group, send email to topbraid-user...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/topbraid-users?hl=en --- 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 javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Group TopBraid Suite Users, the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN. To post to this group, send email to topbraid-users@googlegroups.com To unsubscribe from this group, send email to topbraid-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/topbraid-users?hl=en --- 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-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [topbraid-users] Time Interval Functions
Rich; Not sure if the difference in expectation is with the version TopBraid being used, but using 4.3, smf:duration() takes xsd:dateTime and will return down to the milliseconds. As an example, to get the number of seconds between a dateTime property and the current xsd:dateTime, you can use the following: SELECT ?dur WHERE { ?s ex:dt ?time BIND(smf:duration("s", ?time, now()) AS ?dur) } -- Scott On 2/11/2014, 6:51 PM, Rich Keller wrote: Scott: I'm aware of the SPARQL and TopBraid functions you mention. But to my knowledge, these functions do not operate on duration literals like P0Y0M0DT22H0M0.000S, which was returned by my query subtracting two xsd:time or xsd:dateTime literals (see original post). As I mentioned, smf:duration seems to take two xsd:date variables as input, which means it is not suitable for determining the duration between arbitrary times. Rich On Tuesday, February 11, 2014 9:39:40 AM UTC-8, Scott Henninger wrote: Rich, there are a number of SPARQL and TopBraid functions that work on xsd:time and xsd:dateTime for SPARQL, see http://www.w3.org/TR/sparql11-query/#func-date-time, including year(), month(), day(), hours(), timezone(), etc. TopBraid also has functions for duration, formatting date strings, etc. I.e. you can convert a dateTime string to a date string using dateFormat(). See TopBraid Composer Help TopBraid Composer Reference Functions Overview -- Scott On 2/11/2014, 10:40 AM, Rich Keller wrote: Hi. I have been trying to do some temporal arithmetic in SPARQL and have stumbled upon what I believe are time periods or time intervals. For example SELECT ?a ?aa WHERE { BIND (("08:15:00"^^xsd:time - "10:15:00"^^xsd:time) AS ?a) BIND (("2012-09-08T08:15:00"^^xsd:dateTime - "2012-09-07T10:15:00"^^xsd:dateTime) AS ?aa) } Results: ?a - -P0Y0M0DT2H0M0.000S (negative 2 hours) ?aa - P0Y0M0DT22H0M0.000S (positive 22 hours) My question: Is there any way to operate on these time periods? In particular, suppose I want to convert the length of these these periods into seconds or minutes. smf:duration does something similar, but it works on xsd:date values, and not time periods. If smf:duration took xsd:dateTime or xsd:time arguments, that would be helpful. Do you have any pointers to functions that extract information from these time periods? I suppose I can figure a way to do the arithmetic myself using days(), hours(), minutes() functions, but I would prefer to avoid that. Thanks, Rich Using TBC-SE 4.3.0 -- -- You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN. To post to this group, send email to topbrai...@googlegroups.com To unsubscribe from this group, send email to topbraid-user...@googlegroups.com For more options, visit this group at http://groups.google.com/group/topbraid-users?hl=en --- 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. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN. To post to this group, send email to