Skip to content

Commit b3bc352

Browse files
committed
vocab additions, extra param for info script
1 parent dbdf475 commit b3bc352

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

cromulent/vocab.py

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def register_instance(name, data):
7575
"DoiIdentifier": {"parent": Identifier, "id": "300417432", "label": "DOI Identifer"},
7676
"VolumeNumber": {"parent": Identifier, "id": "300265632", "label": "Volume"},
7777
"IssueNumber": {"parent": Identifier, "id": "300312349", "label": "Issue"},
78+
"CallNumber": {"parent": Identifier, "id": "300311706", "label": "Call Number"},
79+
7880

7981
"EmailAddress": {"parent": Identifier, "id":"300435686", "label": "Email Address"},
8082
"StreetAddress": {"parent": Identifier, "id":"300435687", "label": "Street Address"},
@@ -107,6 +109,7 @@ def register_instance(name, data):
107109
"ContextStatement": {"parent": LinguisticObject, "id": "300435428", "label": "Historical/Cultural Context", "metatype": "brief text"},
108110
"SourceStatement": {"parent": LinguisticObject, "id": "300404764", "label": "Source Statement", "metatype": "brief text"},
109111
"PropertyStatusStatement": {"parent": LinguisticObject, "id": "300438433", "label": "Property Status Statement", "metatype": "brief text"},
112+
"AccessStatement": {"parent": LinguisticObject, "id": "300133046", "label": "Access Statement", "metatype": "brief text"},
110113

111114
"MarkingsStatement": {"parent": LinguisticObject, "id": "300435420", "label": "Markings", "metatype": "brief text"},
112115
"InscriptionStatement": {"parent": LinguisticObject, "id": "300435414", "label": "Inscription", "metatype": "brief text"},

utils/info.py

+23-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
parser.add_argument('what')
77
parser.add_argument('--okay', '--profile', dest="okay", type=bool)
88
parser.add_argument('--filter', dest="filter")
9+
parser.add_argument('--self', dest="onlySelf", type=bool)
910
args = parser.parse_args()
1011

1112
def list_all_props(what, filter=None, okay=None):
@@ -22,6 +23,19 @@ def list_all_props(what, filter=None, okay=None):
2223
props.sort(key=lambda x: x.property)
2324
return props
2425

26+
def list_my_props(what, filter=None, okay=None):
27+
props = []
28+
ks = []
29+
for k,v in what._all_properties.items():
30+
if not k in ks and \
31+
(not okay or (okay and v.profile_okay)) and \
32+
(filter is None or isinstance(filter, v.range) or \
33+
filter is v.range):
34+
props.append(v)
35+
ks.append(k)
36+
props.sort(key=lambda x: x.property)
37+
return props
38+
2539
what = args.what
2640
try:
2741
c = getattr(model, what)
@@ -50,10 +64,17 @@ def list_all_props(what, filter=None, okay=None):
5064
print("Filtered To: None")
5165
print(f"Using Profile: {args.okay}")
5266

67+
68+
69+
model.factory.validate_profile = False
5370
instance = c()
54-
ap = list_all_props(instance, okay=args.okay, filter=f)
5571

56-
ap2 = instance.list_all_props(okay=args.okay, filter=f)
72+
if args.onlySelf:
73+
ap = list_my_props(instance, okay=args.okay, filter=f)
74+
else:
75+
ap = list_all_props(instance, okay=args.okay, filter=f)
76+
77+
#ap2 = instance.list_all_props(okay=args.okay, filter=f)
5778

5879

5980
for pi in ap:

0 commit comments

Comments
 (0)