This file is indexed.

/usr/share/pyshared/zope/dublincore/dcterms.py is in python-zope.dublincore 3.8.2-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Support information for qualified Dublin Core Metadata.
"""
__docformat__ = 'restructuredtext'

from zope.dublincore import dcsv

# useful namespace URIs
DC_NS = "http://purl.org/dc/elements/1.1/"
DCTERMS_NS = "http://purl.org/dc/terms/"
XSI_NS = "http://www.w3.org/2001/XMLSchema-instance"

W3CDTF = "W3CDTF"


def splitEncoding(name):
    if "." not in name:
        return name, None
    parts = name.split(".")
    if parts[-1] in encodings:
        if len(parts) == 2:
            return parts
        else:
            return ".".join(parts[:-1]), parts[-1]
    else:
        return name, None


# The type validator function must raise an exception if the value
# passed isn't valid for the type being check, other just return.

_dcmitypes = {}
for x in ("Collection Dataset Event Image InteractiveResource"
          " Service Software Sound Text PhysicalObject").split():
    _dcmitypes[x.lower()] = x
del x

def check_dcmitype(value):
    if value.lower() not in _dcmitypes:
        raise ValueError("%r not a valid DCMIType")

def check_imt(value):
    pass

def check_iso639_2(value):
    pass

def check_rfc1766(value):
    pass

def check_uri(value):
    pass

def check_point(value):
    pass

def check_iso3166(value):
    pass

def check_box(value):
    pass

def check_tgn(value):
    pass

_period_fields = "name start end scheme".split()

def check_period(value):
    # checks a Period in DCSV format; see:
    # http://dublincore.org/documents/dcmi-period/
    items = dcsv.decode(value)
    d = dcsv.createMapping(items)
    for k in d:
        if k not in _period_fields:
            raise ValueError("unknown field label %r" % k)
    if d.get("scheme", W3CDTF).upper() == W3CDTF:
        if "start" in d:
            check_w3cdtf(d["start"])
        if "end" in d:
            check_w3cdtf(d["end"])

def check_w3cdtf(value):
    pass

def check_rfc3066(value):
    pass

encodings = {
    # name --> (allowed for, validator|None),
    "LCSH":     (("Subject",), None),
    "MESH":     (("Subject",), None),
    "DDC":      (("Subject",), None),
    "LCC":      (("Subject",), None),
    "UDC":      (("Subject",), None),
    "DCMIType": (("Type",), check_dcmitype),
    "IMT":      (("Format",), check_imt),
    "ISO639-2": (("Language",), check_iso639_2),
    "RFC1766":  (("Language",), check_rfc1766),
    "URI":      (("Identifier", "Relation", "Source",), check_uri),
    "Point":    (("Coverage.Spatial",), check_point),
    "ISO3166":  (("Coverage.Spatial",), check_iso3166),
    "Box":      (("Coverage.Spatial",), check_box),
    "TGN":      (("Coverage.Spatial",), check_tgn),
    "Period":   (("Coverage.Temporal",), check_period),
    W3CDTF:     (("Coverage.Temporal", "Date",), check_w3cdtf),
    "RFC3066":  (("Language",), check_rfc3066),
    }


name_to_element = {
    # unqualified DCMES 1.1
    "Title":         ("dc:title",         ""),
    "Creator":       ("dc:creator",       ""),
    "Subject":       ("dc:subject",       ""),
    "Description":   ("dc:description",   ""),
    "Publisher":     ("dc:publisher",     ""),
    "Contributor":   ("dc:contributor",   ""),
    "Date":          ("dc:date",          "dcterms:"+W3CDTF),
    "Type":          ("dc:type",          ""),
    "Format":        ("dc:format",        ""),
    "Identifier":    ("dc:identifier",    ""),
    "Source":        ("dc:source",        ""),
    "Language":      ("dc:language",      ""),
    "Relation":      ("dc:relation",      ""),
    "Coverage":      ("dc:coverage",      ""),
    "Rights":        ("dc:rights",        ""),

    # qualified DCMES 1.1 (directly handled by Zope)
    "Date.Created":  ("dcterms:created",  "dcterms:"+W3CDTF),
    "Date.Modified": ("dcterms:modified", "dcterms:"+W3CDTF),

    # qualified DCMES 1.1 (not used by Zope)
    "Audience":                      ("dcterms:audience", ""),
    "Audience.Education Level":      ("dcterms:educationLevel", ""),
    "Audience.Mediator":             ("dcterms:mediator", ""),
    "Coverage.Spatial":              ("dcterms:spatial", ""),
    "Coverage.Temporal":             ("dcterms:temporal", ""),
    "Date.Accepted":                 ("dcterms:accepted", "dcterms:"+W3CDTF),
    "Date.Available":                ("dcterms:available", "dcterms:"+W3CDTF),
    "Date.Copyrighted":              ("dcterms:copyrighted","dcterms:"+W3CDTF),
    "Date.Issued":                   ("dcterms:issued", "dcterms:"+W3CDTF),
    "Date.Submitted":                ("dcterms:submitted", "dcterms:"+W3CDTF),
    "Date.Valid":                    ("dcterms:valid", "dcterms:"+W3CDTF),
    "Description.Abstract":          ("dcterms:abstract", ""),
    "Description.Table Of Contents": ("dcterms:tableOfContents", ""),
    "Format":                        ("dc:format", ""),
    "Format.Extent":                 ("dcterms:extent", ""),
    "Format.Medium":                 ("dcterms:medium", ""),
    "Identifier.Bibliographic Citation": ("dcterms:bibliographicCitation", ""),
    "Relation.Is Version Of":        ("dcterms:isVersionOf", ""),
    "Relation.Has Version":          ("dcterms:hasVersion", ""),
    "Relation.Is Replaced By":       ("dcterms:isReplacedBy", ""),
    "Relation.Replaces":             ("dcterms:replaces", ""),
    "Relation.Is Required By":       ("dcterms:isRequiredBy", ""),
    "Relation.Requires":             ("dcterms:requires", ""),
    "Relation.Is Part Of":           ("dcterms:isPartOf", ""),
    "Relation.Has Part":             ("dcterms:hasPart", ""),
    "Relation.Is Referenced By":     ("dcterms:isReferencedBy", ""),
    "Relation.References":           ("dcterms:references", ""),
    "Relation.Is Format Of":         ("dcterms:isFormatOf", ""),
    "Relation.Has Format":           ("dcterms:hasFormat", ""),
    "Relation.Conforms To":          ("dcterms:conformsTo", ""),
    "Rights.Access Rights":          ("dcterms:accessRights", ""),
    "Title.Alternative":             ("dcterms:alternative", ""),
    }

_prefix_to_ns = {
    "dc": DC_NS,
    "dcterms": DCTERMS_NS,
    # "xsi": XSI_NS,    dont' use this for element names, only attrs
    }

element_to_name = {}
for name, (qname, attrs) in name_to_element.iteritems():
    prefix, localname = qname.split(":")
    elem_name = _prefix_to_ns[prefix], localname
    element_to_name[elem_name] = name
    name_to_element[name] = (elem_name, attrs)