Skip to content

create_trie

source

.create_trie(
   prefixes
)

Creates a trie

Args

  • prefixes (dict) : prefixes to insert in trie

Returns

The created trie


search_prefix

source

.search_prefix(
   url, dictionary, trie
)

Searches url in prefixes nested dictionary

Args

  • url (str) : url to be found
  • dictionary (dict) : mapping of prefixes and alias
  • trie (Trie) : tree of prefixes

Returns

The alias associated with the url, or null if not found


dictionary_to_json

source

.dictionary_to_json(
   obj, filename
)

Dumps the prefixes dictionary to a JSON file

Args

  • obj (dict) : mapping of prefixes and alias
  • filename (str) : name of the file to be created

extract_namespace_declarations

source

.extract_namespace_declarations(
   g
)

Create a JSON file with prefixes from the graph

Args

  • g (Graph) : graph

infer_common_namespaces

source

.infer_common_namespaces(
   inv_graph_prefix, results, t
)

Create json file with new prefixes

Args

  • inv_graph_prefix (dict) : mapping of prefixes and alias
  • results : graph triples
  • t (Trie) : tree of prefixes