A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://rdflib.readthedocs.io/en/stable/apidocs/../_modules/rdflib/plugins/sparql/datatypes.html below:

rdflib.plugins.sparql.datatypes — rdflib 7.1.4 documentation

"""
Utility functions for supporting the XML Schema Datatypes hierarchy
"""

from __future__ import annotations

from typing import TYPE_CHECKING, Dict, List, Optional, Set

from rdflib.namespace import XSD

if TYPE_CHECKING:
    from rdflib.term import URIRef


XSD_DTs: Set[URIRef] = set(
    (
        XSD.integer,
        XSD.decimal,
        XSD.float,
        XSD.double,
        XSD.string,
        XSD.boolean,
        XSD.dateTime,
        XSD.nonPositiveInteger,
        XSD.negativeInteger,
        XSD.long,
        XSD.int,
        XSD.short,
        XSD.byte,
        XSD.nonNegativeInteger,
        XSD.unsignedLong,
        XSD.unsignedInt,
        XSD.unsignedShort,
        XSD.unsignedByte,
        XSD.positiveInteger,
        XSD.date,
    )
)

# adding dateTime datatypes

XSD_DateTime_DTs = set((XSD.dateTime, XSD.date, XSD.time))

XSD_Duration_DTs = set((XSD.duration, XSD.dayTimeDuration, XSD.yearMonthDuration))

_sub_types: Dict[URIRef, List[URIRef]] = {
    XSD.integer: [
        XSD.nonPositiveInteger,
        XSD.negativeInteger,
        XSD.long,
        XSD.int,
        XSD.short,
        XSD.byte,
        XSD.nonNegativeInteger,
        XSD.positiveInteger,
        XSD.unsignedLong,
        XSD.unsignedInt,
        XSD.unsignedShort,
        XSD.unsignedByte,
    ],
}

_super_types: Dict[URIRef, URIRef] = {}
for superdt in XSD_DTs:
    for subdt in _sub_types.get(superdt, []):
        _super_types[subdt] = superdt

# we only care about float, double, integer, decimal
_typePromotionMap: Dict[URIRef, Dict[URIRef, URIRef]] = {
    XSD.float: {XSD.integer: XSD.float, XSD.decimal: XSD.float, XSD.double: XSD.double},
    XSD.double: {
        XSD.integer: XSD.double,
        XSD.float: XSD.double,
        XSD.decimal: XSD.double,
    },
    XSD.decimal: {
        XSD.integer: XSD.decimal,
        XSD.float: XSD.float,
        XSD.double: XSD.double,
    },
    XSD.integer: {
        XSD.decimal: XSD.decimal,
        XSD.float: XSD.float,
        XSD.double: XSD.double,
    },
}




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4