Skip to content

Commit

Permalink
add labels for defects
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed May 28, 2024
1 parent 3e6dc1b commit b873e63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions atomrdf/network/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def read_ontology():
#CMSO -> PODO IMPURITY
combo.add_path(("cmso:Material", "cmso:hasDefect", "podo:SubstitutionalImpurity"))
combo.add_path(("cmso:Material", "cmso:hasDefect", "podo:InterstitialImpurity"))
combo.add_path(("podo:InterstitialImpurity", "rdfs:label", "string"))
combo.add_path(("cmso:AtomicScaleSample", "podo:hasNumberOfImpurityAtoms", "int"))
combo.add_path(("cmso:AtomicScaleSample", "podo:hasImpurityConcentration", "float"))

Expand Down
9 changes: 6 additions & 3 deletions atomrdf/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,11 +1065,14 @@ def add_interstitial_impurities(
)
json_io.write_file(outfile, datadict)

self.add_triples_for_interstitial_impurities(conc_of_impurities, no_of_impurities=no_of_impurities)
self.add_triples_for_interstitial_impurities(conc_of_impurities, no_of_impurities=no_of_impurities, label=void_type)
return sysn

def add_triples_for_interstitial_impurities(self, conc_of_impurities, no_of_impurities=None):
defect = self.graph.create_node(f"{self._name}_InterstitialImpurity", PODO.InterstitialImpurity)
def add_triples_for_interstitial_impurities(self, conc_of_impurities, no_of_impurities=None, label=None):
if label is not None:
defect = self.graph.create_node(f"{self._name}_InterstitialImpurity", PODO.InterstitialImpurity, label=label)
else:
defect = self.graph.create_node(f"{self._name}_InterstitialImpurity", PODO.InterstitialImpurity)
self.graph.add((self.material, CMSO.hasDefect, defect))
self.graph.add((self.sample, PODO.hasImpurityConcentration, Literal(conc_of_impurities, datatype=XSD.float)))
if no_of_impurities is not None:
Expand Down

0 comments on commit b873e63

Please sign in to comment.