PhyxWrapper
The PhyxWrapper wraps an entire Phyx document.
Static Method Summary
Static Public Methods | ||
public static |
normalize(phyxDocument: *): * Return a provided Phyx document as a normalized JSON document. |
Constructor Summary
Public Constructor | ||
public |
constructor(phyx: Object, newickParser: function(newick: string): {name) Wraps an entire PHYX document. |
Member Summary
Public Members | ||
public get |
|
|
public |
newickParser: * |
|
public |
phyx: * |
Method Summary
Public Methods | ||
public |
Generate an executable ontology from this Phyx document. |
|
public |
Generate an executable ontology from this Phyx document as N-Quads. |
Static Public Methods
public static normalize(phyxDocument: *): * source
Return a provided Phyx document as a normalized JSON document. We ignore most keys -- including keys we don't know -- but any key that can be wrapped by one of the other Wrappers in this package will be wrapped and normalized before being returned.
Normalization is mostly needed for TaxonomicUnitWrappers and its subclasses (TaxonConceptWrapper, TaxonNameWrapper), since these can be represented in several essentially identical ways. But if we implement it at every level, we can implement comparison code in Klados easily.
Two Phyx documents should -- upon being normalized -- be comparable with each other with lodash.deepEqual().
Params:
Name | Type | Attribute | Description |
phyxDocument | * |
Return:
* |
Public Constructors
public constructor(phyx: Object, newickParser: function(newick: string): {name) source
Wraps an entire PHYX document.
Params:
Name | Type | Attribute | Description |
phyx | Object | The Phyx structure to wrap. |
|
newickParser | function(newick: string): {name |
|
A method that accepts a Newick string and returns a list of nodes. Each node should have a 'children' key with its children and optionally a 'name' key with its label. This code previously depended on phylotree.js, whose newick_parser() function works exactly like this. This option allows you to drop in Phylotree's newick_parser() or -- if you prefer -- any other option. |
Public Members
public get defaultNomenCode: * source
public newickParser: * source
public phyx: * source
Public Methods
public asJSONLD(baseIRI: string): Object source
Generate an executable ontology from this Phyx document. The document is mostly in JSON-LD already, except for three important things:
- We have to convert all phylogenies into a series of statements relating to the nodes inside these phylogenies.
- We have to convert phylogenies into OWL restrictions.
- Insert all matches between taxonomic units in this file.
Params:
Name | Type | Attribute | Description |
baseIRI | string |
|
The base IRI to use when generating this Phyx document.
This should include a trailing '#' or '/'. Use '' to indicate that relative IDs
should be generated in the produced ontology (e.g. '#phylogeny1'). Note that if a
baseIRI is provided, then relative IDs already in the Phyx file (identified by an
initial '#') will be turned into absolute IDs by removing the initial |
public toRDF(baseIRI: string, filePath: string): Promise[string] source
Generate an executable ontology from this Phyx document as N-Quads. Under the hood, we generate an OWL/JSON-LD representation of this Phyx document, and then convert it into N-Quads so that OWLAPI-supporting tools can directly consume it.
Params:
Name | Type | Attribute | Description |
baseIRI | string |
|
The base IRI to use when generating this Phyx document.
This should include a trailing '#' or '/'. Use '' to indicate that relative IDs
should be generated in the produced ontology (e.g. '#phylogeny1'). Note that if a
baseIRI is provided, then relative IDs already in the Phyx file (identified by an
initial '#') will be turned into absolute IDs by removing the initial |
filePath | string |
|
The path of the Phyx file being converted.
Used only if the |
Return:
Promise[string] | A Promise to return this Phyx document as a string that can be written to an N-Quads file. |