Skip to content

Commit

Permalink
fix missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholascar committed Aug 17, 2023
1 parent c13be1f commit f6ed2fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rdflib/tools/defined_namespace_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

"""
This rdflib Python script creates a DefinedNamespace Python file from a given RDF file
It is a very simple script: it finds all things defined in the RDF file within a given
namespace:
<thing> a ?x
where ?x is anything and <thing> starts with the given namespace
Nicholas J. Car, Dec, 2021
"""
import argparse
Expand Down Expand Up @@ -77,10 +81,12 @@ def get_target_namespace_elements(
WHERE {
# all things in the RDF data (anything RDF.type...)
?s a ?o .
# get any definitions, if they have one
OPTIONAL {
?s dcterms:description|rdfs:comment|skos:definition ?def
}
# only get results for the target namespace (supplied by user)
FILTER STRSTARTS(STR(?s), "xxx")
}
Expand Down Expand Up @@ -114,9 +120,12 @@ def make_dn_file(
) -> None:
header = f'''from rdflib.term import URIRef
from rdflib.namespace import DefinedNamespace, Namespace
class {object_id}(DefinedNamespace):
"""
DESCRIPTION_EDIT_ME_!
Generated from: SOURCE_RDF_FILE_EDIT_ME_!
Date: {datetime.datetime.utcnow()}
"""
Expand Down

0 comments on commit f6ed2fd

Please sign in to comment.