Skip to content

Commit

Permalink
Accept RDF datatypes in RDF/XML parser (#223)
Browse files Browse the repository at this point in the history
* fix: accept XMLLiterals

* fix: also support unexpected data types

* fix: corrected after review by althonos
  • Loading branch information
chrishmorris authored Apr 24, 2024
1 parent 4db169f commit 9745c09
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pronto/parsers/rdfxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _compact_id(self, iri: str) -> str:
match = re.match(f"^http://purl.obolibrary.org/obo/{id_}#(.*)$", iri)
if match is not None:
return match.group(1)
return iri
return iri

def _compact_datatype(self, iri: str) -> str:
match = re.match("^http://www.w3.org/2001/XMLSchema#(.*)$", iri)
Expand All @@ -182,6 +182,9 @@ def _compact_datatype(self, iri: str) -> str:
match = re.match("^http://www.w3.org/2000/01/rdf-schema#(.*)$", iri)
if match is not None:
return f"rdfs:{match.group(1)}"
match = re.match("^http://www.w3.org/1999/02/22-rdf-syntax-ns#(.*)", iri)
if match is not None:
return f"rdf:{match.group(1)}"
raise iri

def _extract_term_relationship(
Expand Down

0 comments on commit 9745c09

Please sign in to comment.