summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicholascar <nicholas.car@surroundaustralia.com>2021-12-16 09:19:46 +1000
committernicholascar <nicholas.car@surroundaustralia.com>2021-12-16 09:19:46 +1000
commit28288b07074125d87be849d23a53c19605d78b5b (patch)
treed30b934934c035ea351372687b98b9a3599e1bad
parent74302bcf993777c7f7ae494aaf4953c05724d4f3 (diff)
downloadrdflib-28288b07074125d87be849d23a53c19605d78b5b.tar.gz
style fixes only
-rw-r--r--rdflib/namespace/_SDO.py6
-rw-r--r--rdflib/namespace/__init__.py2
-rwxr-xr-xrdflib/plugins/parsers/notation3.py3
-rw-r--r--rdflib/plugins/serializers/xmlwriter.py4
-rw-r--r--rdflib/plugins/shared/jsonld/context.py2
-rw-r--r--rdflib/plugins/shared/jsonld/util.py1
-rw-r--r--rdflib/tools/defined_namespace_creator.py30
-rw-r--r--rdflib/tools/rdfs2dot.py22
8 files changed, 34 insertions, 36 deletions
diff --git a/rdflib/namespace/_SDO.py b/rdflib/namespace/_SDO.py
index a572cad9..9745c518 100644
--- a/rdflib/namespace/_SDO.py
+++ b/rdflib/namespace/_SDO.py
@@ -625,7 +625,7 @@ class SDO(DefinedNamespace):
MayTreatHealthAspect: URIRef # Related topics may be treated by a Topic.
MeasurementTypeEnumeration: URIRef # Enumeration of common measurement types (or dimensions), for example "chest" for a person, "inseam" for pants, "gauge" for screws, or "wheel" for bicycles.
MediaGallery: URIRef # Web page type: Media gallery page. A mixed-media page that can contains media such as images, videos, and other multimedia.
- MediaManipulationRatingEnumeration: URIRef # Codes for use with the [[mediaAuthenticityCategory]] property, indicating the authenticity of a media object (in the context of how it was published or shared). In general these codes are not mutually exclusive, although some combinations (such as 'original' versus 'transformed', 'edited' and 'staged') would be contradictory if applied in the same [[MediaReview]]. Note that the application of these codes is with regard to a piece of media shared or published in a particular context.
+ MediaManipulationRatingEnumeration: URIRef # Codes for use with the [[mediaAuthenticityCategory]] property, indicating the authenticity of a media object (in the context of how it was published or shared). In general these codes are not mutually exclusive, although some combinations (such as 'original' versus 'transformed', 'edited' and 'staged') would be contradictory if applied in the same [[MediaReview]]. Note that the application of these codes is with regard to a piece of media shared or published in a particular context.
MediaObject: URIRef # A media object, such as an image, video, or audio object embedded in a web page or a downloadable dataset i.e. DataDownload. Note that a creative work may have many media objects associated with it on the same web page. For example, a page about a single song (MusicRecording) may have a music video (VideoObject), and a high and low bandwidth audio stream (2 AudioObject's).
MediaReview: URIRef # A [[MediaReview]] is a more specialized form of Review dedicated to the evaluation of media content online, typically in the context of fact-checking and misinformation. For more general reviews of media in the broader sense, use [[UserReview]], [[CriticReview]] or other [[Review]] types. This definition is a work in progress. While the [[MediaManipulationRatingEnumeration]] list reflects significant community review amongst fact-checkers and others working to combat misinformation, the specific structures for representing media objects, their versions and publication context, is still evolving. Similarly, best practices for the relationship between [[MediaReview]] and [[ClaimReview]] markup has not yet been finalized.
MediaReviewItem: URIRef # Represents an item or group of closely related items treated as a unit for the sake of evaluation in a [[MediaReview]]. Authorship etc. apply to the items rather than to the curation/grouping or reviewing party.
@@ -965,7 +965,7 @@ class SDO(DefinedNamespace):
Pulmonary: URIRef # A specific branch of medical science that pertains to the study of the respiratory system and its respective disease states.
QAPage: URIRef # A QAPage is a WebPage focussed on a specific Question and its Answer(s), e.g. in a question answering site or documenting Frequently Asked Questions (FAQs).
QualitativeValue: URIRef # A predefined value for a product characteristic, e.g. the power cord plug type 'US' or the garment sizes 'S', 'M', 'L', and 'XL'.
- QuantitativeValue: URIRef # A point value or interval for product characteristics and other purposes.
+ QuantitativeValue: URIRef # A point value or interval for product characteristics and other purposes.
QuantitativeValueDistribution: URIRef # A statistical distribution of values.
Quantity: URIRef # Quantities such as distance, time, mass, weight, etc. Particular instances of say Mass are entities like '3 Kg' or '4 milligrams'.
Question: URIRef # A specific question - e.g. from a user seeking answers online, or collected in a Frequently Asked Questions (FAQ) document.
@@ -2247,7 +2247,7 @@ class SDO(DefinedNamespace):
observationDate: URIRef # The observationDate of an [[Observation]].
observedNode: URIRef # The observedNode of an [[Observation]], often a [[StatisticalPopulation]].
occupancy: URIRef # The allowed total occupancy for the accommodation in persons (including infants etc). For individual accommodations, this is not necessarily the legal maximum but defines the permitted usage as per the contractual agreement (e.g. a double room used by a single person). Typical unit code(s): C62 for person
- occupationLocation: URIRef # The region/country for which this occupational description is appropriate. Note that educational requirements and qualifications can vary between jurisdictions.
+ occupationLocation: URIRef # The region/country for which this occupational description is appropriate. Note that educational requirements and qualifications can vary between jurisdictions.
occupationalCategory: URIRef # A category describing the job, preferably using a term from a taxonomy such as [BLS O*NET-SOC](http://www.onetcenter.org/taxonomy.html), [ISCO-08](https://www.ilo.org/public/english/bureau/stat/isco/isco08/) or similar, with the property repeated for each applicable value. Ideally the taxonomy should be identified, and both the textual label and formal code for the category should be provided.\n Note: for historical reasons, any textual label and formal code provided as a literal may be assumed to be from O*NET-SOC.
occupationalCredentialAwarded: URIRef # A description of the qualification, award, certificate, diploma or other occupational credential awarded as a consequence of successful completion of this course or program.
offerCount: URIRef # The number of offers for the product.
diff --git a/rdflib/namespace/__init__.py b/rdflib/namespace/__init__.py
index 8ce4de79..e1f0b52b 100644
--- a/rdflib/namespace/__init__.py
+++ b/rdflib/namespace/__init__.py
@@ -445,7 +445,7 @@ class NamespaceManager(object):
pl_namespace = get_longest_namespace(self.__strie[namespace], uri)
if pl_namespace is not None:
namespace = pl_namespace
- name = uri[len(namespace):]
+ name = uri[len(namespace) :]
namespace = URIRef(namespace)
prefix = self.store.prefix(namespace) # warning multiple prefixes problem
diff --git a/rdflib/plugins/parsers/notation3.py b/rdflib/plugins/parsers/notation3.py
index b277a283..2bd85688 100755
--- a/rdflib/plugins/parsers/notation3.py
+++ b/rdflib/plugins/parsers/notation3.py
@@ -1899,8 +1899,7 @@ class TurtleParser(Parser):
if encoding not in [None, "utf-8"]:
raise ParserError(
- "N3/Turtle files are always utf-8 encoded, I was passed: %s"
- % encoding
+ "N3/Turtle files are always utf-8 encoded, I was passed: %s" % encoding
)
sink = RDFSink(graph)
diff --git a/rdflib/plugins/serializers/xmlwriter.py b/rdflib/plugins/serializers/xmlwriter.py
index 99d1e767..b0f1a06e 100644
--- a/rdflib/plugins/serializers/xmlwriter.py
+++ b/rdflib/plugins/serializers/xmlwriter.py
@@ -100,8 +100,8 @@ class XMLWriter(object):
for pre, ns in self.extra_ns.items():
if uri.startswith(ns):
if pre != "":
- return ":".join(pre, uri[len(ns):])
+ return ":".join(pre, uri[len(ns) :])
else:
- return uri[len(ns):]
+ return uri[len(ns) :]
return self.nm.qname_strict(uri)
diff --git a/rdflib/plugins/shared/jsonld/context.py b/rdflib/plugins/shared/jsonld/context.py
index c91107b4..2bf38f44 100644
--- a/rdflib/plugins/shared/jsonld/context.py
+++ b/rdflib/plugins/shared/jsonld/context.py
@@ -37,7 +37,7 @@ from .keys import (
from .errors import (
INVALID_REMOTE_CONTEXT,
RECURSIVE_CONTEXT_INCLUSION,
- INVALID_CONTEXT_ENTRY
+ INVALID_CONTEXT_ENTRY,
)
from .util import source_to_json, urljoin, urlsplit, split_iri, norm_url
diff --git a/rdflib/plugins/shared/jsonld/util.py b/rdflib/plugins/shared/jsonld/util.py
index 8a0cfa74..e703c14c 100644
--- a/rdflib/plugins/shared/jsonld/util.py
+++ b/rdflib/plugins/shared/jsonld/util.py
@@ -44,6 +44,7 @@ def source_to_json(source):
finally:
stream.close()
+
VOCAB_DELIMS = ("#", "/", ":")
diff --git a/rdflib/tools/defined_namespace_creator.py b/rdflib/tools/defined_namespace_creator.py
index 82803f9d..f3eeaecf 100644
--- a/rdflib/tools/defined_namespace_creator.py
+++ b/rdflib/tools/defined_namespace_creator.py
@@ -82,7 +82,9 @@ def get_target_namespace_elements(g, target_namespace):
# only get results for the target namespace (supplied by user)
FILTER STRSTARTS(STR(?s), "xxx")
}
- """.replace("xxx", target_namespace)
+ """.replace(
+ "xxx", target_namespace
+ )
elements = []
for r in g.query(q, initNs=namespaces):
elements.append((str(r[0]), str(r[1])))
@@ -92,7 +94,9 @@ def get_target_namespace_elements(g, target_namespace):
elements_strs = []
for e in elements:
desc = e[1].replace('\n', ' ')
- elements_strs.append(f" {e[0].replace(args.target_namespace, '')}: URIRef # {desc}\n")
+ elements_strs.append(
+ f" {e[0].replace(args.target_namespace, '')}: URIRef # {desc}\n"
+ )
return elements, elements_strs
@@ -134,7 +138,7 @@ if __name__ == "__main__":
"target_namespace",
type=str,
help="The namespace within the ontology that you want to create a "
- "DefinedNamespace for.",
+ "DefinedNamespace for.",
)
parser.add_argument(
@@ -144,11 +148,12 @@ if __name__ == "__main__":
)
parser.add_argument(
- '-f', "--fail",
+ '-f',
+ "--fail",
dest='fail',
action='store_true',
help="Whether (true) or not (false) to mimic ClosedNamespace and fail on "
- "non-element use"
+ "non-element use",
)
parser.add_argument('--no-fail', dest='fail', action='store_false')
parser.set_defaults(feature=False)
@@ -165,8 +170,10 @@ if __name__ == "__main__":
validate_object_id(args.object_id)
- print(f"Creating DefinedNamespace file {args.object_id} "
- f"for {args.target_namespace}...")
+ print(
+ f"Creating DefinedNamespace file {args.object_id} "
+ f"for {args.target_namespace}..."
+ )
print(f"Ontology with {len(g)} triples loaded...")
print("Getting all namespace elements...")
@@ -175,12 +182,5 @@ if __name__ == "__main__":
output_file_name = Path().cwd() / f"_{args.object_id}.py"
print(f"Creating DefinedNamespace Python file {output_file_name}")
make_dn_file(
- output_file_name,
- args.target_namespace,
- elements[1],
- args.object_id,
- args.fail
+ output_file_name, args.target_namespace, elements[1], args.object_id, args.fail
)
-
-
-
diff --git a/rdflib/tools/rdfs2dot.py b/rdflib/tools/rdfs2dot.py
index cb8d0bfd..a9eeb244 100644
--- a/rdflib/tools/rdfs2dot.py
+++ b/rdflib/tools/rdfs2dot.py
@@ -80,21 +80,19 @@ def rdfs2dot(g, stream, opts={}):
fields = collections.defaultdict(set)
nodes = {}
- def node(x):
-
- if x not in nodes:
- nodes[x] = "node%d" % len(nodes)
- return nodes[x]
-
- def label(x, g):
-
- l_ = g.value(x, RDFS.label)
- if l_ is None:
+ def node(nd):
+ if nd not in nodes:
+ nodes[nd] = "node%d" % len(nodes)
+ return nodes[nd]
+
+ def label(xx, grf):
+ lbl = g.value(xx, RDFS.label)
+ if lbl is None:
try:
- l_ = g.namespace_manager.compute_qname(x)[2]
+ lbl = grf.namespace_manager.compute_qname(xx)[2]
except:
pass # bnodes and some weird URIs cannot be split
- return l_
+ return lbl
stream.write('digraph { \n node [ fontname="DejaVu Sans" ] ; \n')