Extra schema

merge-requests/23/head
Bob Mottram 2022-04-03 20:53:48 +01:00
parent e2bc95c9db
commit 42dba93382
2 changed files with 47 additions and 0 deletions

View File

@ -13,6 +13,7 @@ VALID_CONTEXTS = (
"https://w3id.org/identity/v1",
"https://w3id.org/security/v1",
"*/apschema/v1.9",
"*/apschema/v1.10",
"*/apschema/v1.21",
"*/apschema/v1.20",
"*/litepub-0.1.jsonld",
@ -156,6 +157,44 @@ def getApschemaV1_20() -> {}:
}
def getApschemaV1_10() -> {}:
# https://domain/apschema/v1.10
return {
'@context': {
'Hashtag': 'as:Hashtag',
'PropertyValue': 'schema:PropertyValue',
'commentPolicy': 'zot:commentPolicy',
'conversation': 'ostatus:conversation',
'diaspora': 'https://diasporafoundation.org/ns/',
'directMessage': 'zot:directMessage',
'emojiReaction': 'zot:emojiReaction',
'expires': 'zot:expires',
'guid': 'diaspora:guid',
'id': '@id',
'locationAddress': 'zot:locationAddress',
'locationDeleted': 'zot:locationDeleted',
'locationPrimary': 'zot:locationPrimary',
'magicEnv': {'@id': 'zot:magicEnv', '@type': '@id'},
'manuallyApprovesFollowers': 'as:manuallyApprovesFollowers',
'meAlgorithm': 'zot:meAlgorithm',
'meCreator': 'zot:meCreator',
'meData': 'zot:meData',
'meDataType': 'zot:meDataType',
'meEncoding': 'zot:meEncoding',
'meSignatureValue': 'zot:meSignatureValue',
'nomadicHubs': 'zot:nomadicHubs',
'nomadicLocation': 'zot:nomadicLocation',
'nomadicLocations': {'@id': 'zot:nomadicLocations',
'@type': '@id'},
'ostatus': 'http://ostatus.org#',
'schema': 'http://schema.org#',
'type': '@type',
'value': 'schema:value',
'zot': 'https://hubzilla.vikshepa.com/apschema#'
}
}
def getApschemaV1_21() -> {}:
# https://domain/apschema/v1.21
return {

View File

@ -39,6 +39,7 @@ from collections import deque, namedtuple
from numbers import Integral, Real
from context import getApschemaV1_9
from context import getApschemaV1_10
from context import getApschemaV1_20
from context import getApschemaV1_21
from context import getLitepubV0_1
@ -410,6 +411,13 @@ def load_document(url):
'document': getApschemaV1_9()
}
return doc
elif url.endswith('/apschema/v1.10'):
doc = {
'contextUrl': None,
'documentUrl': url,
'document': getApschemaV1_10()
}
return doc
elif url.endswith('/apschema/v1.20'):
doc = {
'contextUrl': None,