Skip to content

Commit

Permalink
Improve property values in OBO export
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Aug 18, 2023
1 parent fc1cda6 commit 6311733
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pyobo/struct/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,10 @@ def iterate_obo_lines(self) -> Iterable[str]:

if self.name is None:
raise ValueError("ontology is missing name")
yield f"remark: {self.name}"
yield f'property_value: http://purl.org/dc/elements/1.1/title "{self.name}" xsd:string'

for root_term in self.root_terms or []:
yield f"property_value: IAO:0000700 {root_term.curie}"

for typedef in sorted(self.typedefs or [], key=attrgetter("curie")):
yield from typedef.iterate_obo_lines()
Expand Down Expand Up @@ -1349,6 +1352,7 @@ def make_ad_hoc_ontology(
_date: Optional[datetime] = None,
_data_version: Optional[str] = None,
_idspaces: Optional[Mapping[str, str]] = None,
_root_terms: Optional[List[Reference]] = None,
*,
terms: List[Term],
) -> "Obo":
Expand All @@ -1364,6 +1368,7 @@ class AdHocOntology(Obo):
typedefs = _typedefs
synonym_typedefs = _synonym_typedefs
idspaces = _idspaces
root_terms = _root_terms

def __post_init__(self):
self.date = _date
Expand Down

0 comments on commit 6311733

Please sign in to comment.