Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jsonschema
requests
jsonpath_rw
ruamel.yaml
jsonschema2md
jsonschema2md>=0.4,<0.5
pandas
tabulate

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def update_relative_links(readme_content):
package_dir={'': 'src'},
packages=["dosdp", "schema", "dosdp.document", "dosdp.document.pattern", "dosdp.document.schema"],
include_package_data=True,
install_requires=["PyYAML", "jsonschema", "requests", "jsonpath_rw", "ruamel.yaml", "jsonschema2md", "pandas"],
install_requires=["PyYAML", "jsonschema", "requests", "jsonpath_rw", "ruamel.yaml", "jsonschema2md>=0.4,<0.5", "pandas", "tabulate"],
entry_points={
"console_scripts": [
"dosdp=dosdp.__main__:main",
Expand Down
2 changes: 1 addition & 1 deletion src/dosdp/document/pattern/patterns_create_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def generate_pattern_documentation(pattern_file, md_file_path, sample_data_dir=N
else:
print("No matches!")
except Exception as e:
logging.error("Error processing the tsv file!", e)
logging.error("Error processing the tsv file! %s", e)
else:
logging.warning("Data dir: '" + os.path.join(str(sample_data_dir),
sample_file) + "' does not exist to provide sample data!")
Expand Down
36 changes: 36 additions & 0 deletions src/schema/dosdp_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ definitions:
leaving this field out.
items: {type: string}
type: array
permutations:
description: >
Optional list of permutation specifications. For each variable specified,
generates additional annotations using the values of the specified annotation
properties from the filler term. The label-based annotation is always generated
in addition to the permutations. If multiple permutation entries exist for
different variables, the cartesian product of all values is generated.
type: array
items: { $ref: '#/definitions/permutation' }
multi_clause:
items: { $ref: '#/definitions/multi_clause_printf' }

Expand Down Expand Up @@ -219,6 +228,24 @@ definitions:
type: string
description: perl style regex sub. May include backreferences.

permutation:
type: object
additionalProperties: False
required: [var, annotationProperties]
properties:
var:
description: >
The name of a single variable for which to generate permutations.
Must correspond to a variable specified in the 'vars' field of the pattern.
type: string
annotationProperties:
description: >
A list of annotation property names (as declared in the annotationProperties
dictionary) whose values from the filler term will be used to generate
additional annotations. Each value found generates a separate annotation.
type: array
items: { type: string }

opa:
type: object
additionalProperties: False
Expand Down Expand Up @@ -272,6 +299,15 @@ definitions:
used in the substitution.
items: {type: string}
type: array
permutations:
description: >
Optional list of permutation specifications. For each variable specified,
generates additional annotations using the values of the specified annotation
properties from the filler term. The label-based annotation is always generated
in addition to the permutations. If multiple permutation entries exist for
different variables, the cartesian product of all values is generated.
type: array
items: { $ref: '#/definitions/permutation' }
multi_clause:
items: { $ref: '#/definitions/multi_clause_printf' }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
pattern_name: acute_with_permutations

pattern_iri: http://purl.obolibrary.org/obo/mondo/patterns/acute_with_permutations.yaml

description: 'Test pattern demonstrating the permutations feature for synonym generation.
This pattern generates additional synonyms by permuting over the exact_synonym
values of the disease filler term.'

contributors:
- https://orcid.org/0000-0002-6601-2165

classes:
acute: PATO:0000389
disease: MONDO:0000001

relations:
has modifier: RO:0002573

annotationProperties:
exact_synonym: oio:hasExactSynonym
related_synonym: oio:hasRelatedSynonym

vars:
disease: '''disease'''

name:
text: acute %s
vars:
- disease

annotations:
- annotationProperty: exact_synonym
text: '%s, acute'
permutations:
- var: disease
annotationProperties:
- exact_synonym
vars:
- disease

def:
text: Acute form of %s.
vars:
- disease

equivalentTo:
text: '%s and ''has modifier'' some ''acute'''
vars:
- disease