eyeling 1.7.13 → 1.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eyeling.js +30 -2
- package/package.json +1 -1
package/eyeling.js
CHANGED
|
@@ -3542,7 +3542,7 @@ function parseXsdDatetimeTerm(t) {
|
|
|
3542
3542
|
|
|
3543
3543
|
function parseXsdDateTimeLexParts(t) {
|
|
3544
3544
|
// Parse *lexical* components of an xsd:dateTime literal without timezone normalization.
|
|
3545
|
-
// Returns { yearStr, month, day, minute, second, tz } or null.
|
|
3545
|
+
// Returns { yearStr, month, day, hour, minute, second, tz } or null.
|
|
3546
3546
|
if (!(t instanceof Literal)) return null;
|
|
3547
3547
|
const [lex, dt] = literalParts(t.value);
|
|
3548
3548
|
if (dt !== XSD_NS + 'dateTime') return null;
|
|
@@ -3555,16 +3555,18 @@ function parseXsdDateTimeLexParts(t) {
|
|
|
3555
3555
|
const yearStr = m[1];
|
|
3556
3556
|
const month = parseInt(m[2], 10);
|
|
3557
3557
|
const day = parseInt(m[3], 10);
|
|
3558
|
+
const hour = parseInt(m[4], 10);
|
|
3558
3559
|
const minute = parseInt(m[5], 10);
|
|
3559
3560
|
const second = parseInt(m[6], 10);
|
|
3560
3561
|
const tz = m[7] || null;
|
|
3561
3562
|
|
|
3562
3563
|
if (!(month >= 1 && month <= 12)) return null;
|
|
3563
3564
|
if (!(day >= 1 && day <= 31)) return null;
|
|
3565
|
+
if (!(hour >= 0 && hour <= 23)) return null;
|
|
3564
3566
|
if (!(minute >= 0 && minute <= 59)) return null;
|
|
3565
3567
|
if (!(second >= 0 && second <= 59)) return null;
|
|
3566
3568
|
|
|
3567
|
-
return { yearStr, month, day, minute, second, tz };
|
|
3569
|
+
return { yearStr, month, day, hour, minute, second, tz };
|
|
3568
3570
|
}
|
|
3569
3571
|
|
|
3570
3572
|
function parseDatetimeLike(t) {
|
|
@@ -4689,6 +4691,32 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen) {
|
|
|
4689
4691
|
return s2 !== null ? [s2] : [];
|
|
4690
4692
|
}
|
|
4691
4693
|
|
|
4694
|
+
// time:hour
|
|
4695
|
+
// Gets as object the integer hour component of the subject xsd:dateTime.
|
|
4696
|
+
// Schema: $s+ time:hour $o-
|
|
4697
|
+
if (pv === TIME_NS + 'hour') {
|
|
4698
|
+
const parts = parseXsdDateTimeLexParts(g.s);
|
|
4699
|
+
if (!parts) return [];
|
|
4700
|
+
const out = internLiteral(String(parts.hour));
|
|
4701
|
+
|
|
4702
|
+
if (g.o instanceof Var) {
|
|
4703
|
+
const s2 = { ...subst };
|
|
4704
|
+
s2[g.o.name] = out;
|
|
4705
|
+
return [s2];
|
|
4706
|
+
}
|
|
4707
|
+
if (g.o instanceof Blank) return [{ ...subst }];
|
|
4708
|
+
|
|
4709
|
+
const oi = parseIntLiteral(g.o);
|
|
4710
|
+
if (oi !== null) {
|
|
4711
|
+
try {
|
|
4712
|
+
if (oi === BigInt(parts.hour)) return [{ ...subst }];
|
|
4713
|
+
} catch {}
|
|
4714
|
+
}
|
|
4715
|
+
|
|
4716
|
+
const s2 = unifyTerm(g.o, out, subst);
|
|
4717
|
+
return s2 !== null ? [s2] : [];
|
|
4718
|
+
}
|
|
4719
|
+
|
|
4692
4720
|
// time:minute
|
|
4693
4721
|
// Gets as object the integer minutes component of the subject xsd:dateTime.
|
|
4694
4722
|
// Schema: $s+ time:minute $o-
|