Skip to content

Commit 0bac93c

Browse files
Complete XSD types for tdbpy (#408)
Complete XSD types for tdbpy Fixes #406
1 parent 0752c92 commit 0bac93c

File tree

2 files changed

+96
-2
lines changed

2 files changed

+96
-2
lines changed

terminusdb_client/schema/schema.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,38 @@
1111

1212
from .. import woql_type as wt
1313
from ..client import Client, GraphType
14-
from ..woql_type import to_woql_type
14+
from ..woql_type import ( # noqa: F401
15+
to_woql_type,
16+
anySimpleType,
17+
decimal,
18+
dateTimeStamp,
19+
gYear,
20+
gMonth,
21+
gDay,
22+
gYearMonth,
23+
yearMonthDuration,
24+
dayTimeDuration,
25+
byte,
26+
short,
27+
long,
28+
unsignedByte,
29+
unsignedShort,
30+
unsignedInt,
31+
unsignedLong,
32+
positiveInteger,
33+
negativeInteger,
34+
nonPositiveInteger,
35+
nonNegativeInteger,
36+
base64Binary,
37+
hexBinary,
38+
anyURI,
39+
language,
40+
normalizedString,
41+
token,
42+
NMTOKEN,
43+
Name,
44+
NCName,
45+
)
1546

1647

1748
class TerminusKey:

terminusdb_client/woql_type.py

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,80 @@
11
import datetime as dt
22
from enum import Enum
3-
from typing import ForwardRef, List, Optional, Set, Union
3+
from typing import ForwardRef, List, Optional, Set, Union, NewType
4+
5+
anyURI = NewType('anyURI', str) # noqa: N816
6+
anySimpleType = NewType('anySimpleType', str) # noqa: N816
7+
decimal = NewType('decimal', str)
8+
dateTimeStamp = NewType('dateTimeStamp', dt.datetime) # noqa: N816
9+
gYear = NewType('gYear', str) # noqa: N816
10+
gMonth = NewType('gMonth', str) # noqa: N816
11+
gDay = NewType('gDay', str) # noqa: N816
12+
gYearMonth = NewType('gYearMonth', str) # noqa: N816
13+
yearMonthDuration = NewType('yearMonthDuration', str) # noqa: N816
14+
dayTimeDuration = NewType('dayTimeDuration', str) # noqa: N816
15+
byte = NewType('byte', int)
16+
short = NewType('short', int)
17+
long = NewType('long', int)
18+
unsignedByte = NewType('unsignedByte', int) # noqa: N816
19+
unsignedShort = NewType('unsignedShort', int) # noqa: N816
20+
unsignedInt = NewType('unsignedInt', int) # noqa: N816
21+
unsignedLong = NewType('unsignedLong', int) # noqa: N816
22+
positiveInteger = NewType('positiveInteger', int) # noqa: N816
23+
negativeInteger = NewType('negativeInteger', int) # noqa: N816
24+
nonPositiveInteger = NewType('nonPositiveInteger', int) # noqa: N816
25+
nonNegativeInteger = NewType('nonNegativeInteger', int) # noqa: N816
26+
base64Binary = NewType('base64Binary', str) # noqa: N816
27+
hexBinary = NewType('hexBinary', str) # noqa: N816
28+
anyURI = NewType('anyURI', str) # noqa: N816
29+
language = NewType('language', str)
30+
normalizedString = NewType('normalizedString', str) # noqa: N816
31+
token = NewType('token', str)
32+
NMTOKEN = NewType('NMTOKEN', str)
33+
Name = NewType('Name', str)
34+
NCName = NewType('NCName', str)
435

536
CONVERT_TYPE = {
637
str: "xsd:string",
738
bool: "xsd:boolean",
839
float: "xsd:double",
940
int: "xsd:integer",
41+
long: "xsd:long",
1042
dict: "sys:JSON",
43+
gYear: "xsd:gYear",
1144
dt.datetime: "xsd:dateTime",
1245
dt.date: "xsd:date",
1346
dt.time: "xsd:time",
1447
dt.timedelta: "xsd:duration",
48+
anyURI : "xsd:anyURI",
49+
anySimpleType : "xsd:anySimpleType",
50+
decimal : "xsd:decimal",
51+
dateTimeStamp : "xsd:dateTimeStamp",
52+
gYear : "xsd:gYear",
53+
gMonth : "xsd:gMonth",
54+
gDay : "xsd:gDay",
55+
gYearMonth : "xsd:gYearMonth",
56+
yearMonthDuration : "xsd:yearMonthDuration",
57+
dayTimeDuration : "xsd:dayTimeDuration",
58+
byte : "xsd:byte",
59+
short : "xsd:short",
60+
long : "xsd:long",
61+
unsignedByte : "xsd:unsignedByte",
62+
unsignedShort : "xsd:unsignedShort",
63+
unsignedInt : "xsd:unsignedInt",
64+
unsignedLong : "xsd:unsignedLong",
65+
positiveInteger : "xsd:positiveInteger",
66+
negativeInteger : "xsd:negativeInteger",
67+
nonPositiveInteger : "xsd:nonPositiveInteger",
68+
nonNegativeInteger : "xsd:nonNegativeInteger",
69+
base64Binary : "xsd:base64Binary",
70+
hexBinary : "xsd:hexBinary",
71+
anyURI : "xsd:anyURI",
72+
language : "xsd:language",
73+
normalizedString : "xsd:normalizedString",
74+
token : "xsd:token",
75+
NMTOKEN : "xsd:NMTOKEN",
76+
Name : "xsd:Name",
77+
NCName : "xsd:NCName",
1578
}
1679

1780

0 commit comments

Comments
 (0)