File: constants.py

package info (click to toggle)
rdflib-sqlalchemy 0.5.4%2Bgit99f4689-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,544 kB
  • sloc: python: 2,418; sh: 20; makefile: 3
file content (72 lines) | stat: -rw-r--r-- 2,130 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""Constant definitions"""
from rdflib import BNode, Literal, URIRef, Variable


COUNT_SELECT = 0
''' Return the count of the number of result tuples '''

CONTEXT_SELECT = 1
''' Return the matching contexts '''

TRIPLE_SELECT = 2
''' Return the matching triples '''

TRIPLE_SELECT_NO_ORDER = 3
''' Return the matching triples in any order '''

ASSERTED_NON_TYPE_PARTITION = 3
''' Table of non-type triples '''

ASSERTED_TYPE_PARTITION = 4
''' Table of type triples '''

QUOTED_PARTITION = 5
''' Table of `quoted`_ type triples

.. _quoted: https://rdflib.readthedocs.io/en/stable/univrdfstore.html#terminology
'''

ASSERTED_LITERAL_PARTITION = 6
''' Table of triples with literals '''

FULL_TRIPLE_PARTITIONS = [QUOTED_PARTITION, ASSERTED_LITERAL_PARTITION]

INTERNED_PREFIX = "kb_"

TERM_COMBINATIONS = dict([(term, index) for index, term in enumerate([
    "UUUU", "UUUB", "UUUF", "UUVU", "UUVB", "UUVF", "UUBU", "UUBB", "UUBF",
    "UULU", "UULB", "UULF", "UUFU", "UUFB", "UUFF",
    #
    "UVUU", "UVUB", "UVUF", "UVVU", "UVVB", "UVVF", "UVBU", "UVBB", "UVBF",
    "UVLU", "UVLB", "UVLF", "UVFU", "UVFB", "UVFF",
    #
    "VUUU", "VUUB", "VUUF", "VUVU", "VUVB", "VUVF", "VUBU", "VUBB", "VUBF",
    "VULU", "VULB", "VULF", "VUFU", "VUFB", "VUFF",
    #
    "VVUU", "VVUB", "VVUF", "VVVU", "VVVB", "VVVF", "VVBU", "VVBB", "VVBF",
    "VVLU", "VVLB", "VVLF", "VVFU", "VVFB", "VVFF",
    #
    "BUUU", "BUUB", "BUUF", "BUVU", "BUVB", "BUVF", "BUBU", "BUBB", "BUBF",
    "BULU", "BULB", "BULF", "BUFU", "BUFB", "BUFF",
    #
    "BVUU", "BVUB", "BVUF", "BVVU", "BVVB", "BVVF", "BVBU", "BVBB", "BVBF",
    "BVLU", "BVLB", "BVLF", "BVFU", "BVFB", "BVFF",
    #
    "FUUU", "FUUB", "FUUF", "FUVU", "FUVB", "FUVF", "FUBU", "FUBB", "FUBF",
    "FULU", "FULB", "FULF", "FUFU", "FUFB", "FUFF",
    #
    "FVUU", "FVUB", "FVUF", "FVVU", "FVVB", "FVVF", "FVBU", "FVBB", "FVBF",
    "FVLU", "FVLB", "FVLF", "FVFU", "FVFB", "FVFF",
])])

REVERSE_TERM_COMBINATIONS = dict([
    (value, key)
    for key, value in TERM_COMBINATIONS.items()
])

TERM_INSTANTIATION_DICT = {
    "U": URIRef,
    "B": BNode,
    "V": Variable,
    "L": Literal
}