Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/rdflib/plugins/parsers/pyMicrodata/registry.py @ 1:56ad4e20f292 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author | guerler |
---|---|
date | Fri, 31 Jul 2020 00:32:28 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:d30785e31577 | 1:56ad4e20f292 |
---|---|
1 # -*- coding: utf-8 -*- | |
2 """ | |
3 | |
4 Hardcoded version of the current microdata->RDF registry. There is also a local registry to include some test cases. | |
5 Finally, there is a local dictionary for prefix mapping for the registry items; these are the preferred prefixes | |
6 for those vocabularies, and are used to make the output nicer. | |
7 | |
8 @organization: U{World Wide Web Consortium<http://www.w3.org>} | |
9 @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} | |
10 @license: This software is available for use under the | |
11 U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">} | |
12 """ | |
13 | |
14 """ | |
15 $Id: registry.py,v 1.5 2012/09/05 16:40:43 ivan Exp $ | |
16 $Date: 2012/09/05 16:40:43 $ | |
17 """ | |
18 | |
19 import sys | |
20 (py_v_major, py_v_minor, py_v_micro, py_v_final, py_v_serial) = sys.version_info | |
21 | |
22 # To be added soon: | |
23 # "Class" : {"subPropertyOf" : "http://www.w3.org/2000/01/rdf-schema#Class"}, | |
24 # "Property" : {"subPropertyOf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"} | |
25 | |
26 _registry = """ | |
27 { | |
28 "http://schema.org/": { | |
29 "propertyURI": "vocabulary", | |
30 "multipleValues": "unordered", | |
31 "properties": { | |
32 "additionalType": {"subPropertyOf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}, | |
33 "blogPosts": {"multipleValues": "list"}, | |
34 "breadcrumb": {"multipleValues": "list"}, | |
35 "byArtist": {"multipleValues": "list"}, | |
36 "creator": {"multipleValues": "list"}, | |
37 "episode": {"multipleValues": "list"}, | |
38 "episodes": {"multipleValues": "list"}, | |
39 "event": {"multipleValues": "list"}, | |
40 "events": {"multipleValues": "list"}, | |
41 "founder": {"multipleValues": "list"}, | |
42 "founders": {"multipleValues": "list"}, | |
43 "itemListElement": {"multipleValues": "list"}, | |
44 "musicGroupMember": {"multipleValues": "list"}, | |
45 "performerIn": {"multipleValues": "list"}, | |
46 "actor": {"multipleValues": "list"}, | |
47 "actors": {"multipleValues": "list"}, | |
48 "performer": {"multipleValues": "list"}, | |
49 "performers": {"multipleValues": "list"}, | |
50 "producer": {"multipleValues": "list"}, | |
51 "recipeInstructions": {"multipleValues": "list"}, | |
52 "season": {"multipleValues": "list"}, | |
53 "seasons": {"multipleValues": "list"}, | |
54 "subEvent": {"multipleValues": "list"}, | |
55 "subEvents": {"multipleValues": "list"}, | |
56 "track": {"multipleValues": "list"}, | |
57 "tracks": {"multipleValues": "list"} | |
58 } | |
59 }, | |
60 "http://microformats.org/profile/hcard": { | |
61 "propertyURI": "vocabulary", | |
62 "multipleValues": "unordered" | |
63 }, | |
64 "http://microformats.org/profile/hcalendar#": { | |
65 "propertyURI": "vocabulary", | |
66 "multipleValues": "unordered", | |
67 "properties": { | |
68 "categories": {"multipleValues": "list"} | |
69 } | |
70 } | |
71 } | |
72 """ | |
73 | |
74 vocab_names = { | |
75 "http://schema.org/" : "schema", | |
76 "http://xmlns.com/foaf/0.1/" : "foaf", | |
77 "http://microformats.org/profile/hcard#" : "hcard", | |
78 "http://microformats.org/profile/hcalendar#" : "hcalendar" | |
79 } | |
80 | |
81 # This is the local version, added mainly for testing | |
82 _myRegistry = """ | |
83 { | |
84 "http://vocabulary.list/": { | |
85 "propertyURI": "vocabulary", | |
86 "multipleValues": "list", | |
87 "properties": { | |
88 "list": {"multipleValues": "list"}, | |
89 "typed": {"datatype": "http://typed"} | |
90 } | |
91 }, | |
92 "http://vocabulary.unordered/": { | |
93 "propertyURI": "vocabulary", | |
94 "multipleValues": "unordered", | |
95 "properties": { | |
96 "list": {"multipleValues": "list"}, | |
97 "typed": {"datatype": "http://typed"} | |
98 } | |
99 }, | |
100 "http://contextual.unordered/": { | |
101 "propertyURI": "contextual", | |
102 "multipleValues": "unordered", | |
103 "properties": { | |
104 "list": {"multipleValues": "list"}, | |
105 "typed": {"datatype": "http://typed"} | |
106 } | |
107 }, | |
108 "http://contextual.list/": { | |
109 "propertyURI": "contextual", | |
110 "multipleValues": "list", | |
111 "properties": { | |
112 "list": {"multipleValues": "list"}, | |
113 "typed": {"datatype": "http://typed"} | |
114 } | |
115 }, | |
116 "http://n.whatwg.org/work": { | |
117 "propertyURI" : "contextual", | |
118 "multipleValues" : "list" | |
119 } | |
120 } | |
121 """ | |
122 | |
123 | |
124 registry = [] | |
125 myRegistry = [] | |
126 if py_v_major >= 3 or (py_v_major == 2 and py_v_minor >= 6) : | |
127 import json | |
128 registry = json.loads(_registry) | |
129 myRegistry = json.loads(_myRegistry) | |
130 else : | |
131 import simplejson | |
132 registry = simplejson.loads(_registry) | |
133 myRegistry = simplejson.loads(_myRegistry) | |
134 | |
135 for (k,v) in list(myRegistry.items()) : registry[k] = v |