Skip to content

Commit

Permalink
Updated periodic table to 1.0.0-beta5
Browse files Browse the repository at this point in the history
No semantic changes. Only updates of the Python script and serialisation.
  • Loading branch information
jesper-friis committed Jan 16, 2024
1 parent fc000f3 commit 7473c66
Show file tree
Hide file tree
Showing 2 changed files with 836 additions and 829 deletions.
16 changes: 12 additions & 4 deletions disciplines/periodictable.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ def en(s):
#world = World(filename='periodictable.sqlite3')
world = World()
chemistry = world.get_ontology(os.path.join(thisdir, 'chemistry.ttl')).load()
perceptual = world.get_ontology(os.path.join(thisdir, '../perspectives/perceptual.ttl')).load()
perceptual = world.get_ontology(
os.path.join(thisdir, '../perspectives/perceptual.ttl')
).load()
#emmo_middle.sync_python_names()

# Create new ontology
onto = world.get_ontology('http://emmo.info/emmo/disciplines/periodictable#')
onto.base_iri = 'http://emmo.info/emmo/disciplines/periodictable#'
onto.iri = 'http://emmo.info/emmo/disciplines/periodictable#'
onto.base_iri = 'http://emmo.info/emmo#'
onto.prefix = 'emmo'
onto.imported_ontologies.append(perceptual)
onto.imported_ontologies.append(chemistry)
onto.sync_python_names()
Expand Down Expand Up @@ -80,7 +84,9 @@ class hasChemicalSymbol(onto.hasProperty):

print(Z, symbol, name, mass)

Element = types.new_class(name.capitalize() + 'Symbol', (onto.ChemicalElement, ))
Element = types.new_class(
name.capitalize() + 'Symbol', (onto.ChemicalElement, )
)
Element.is_a.append(onto.hasSymbolValue.value(symbol))

AtomClass = types.new_class(name.capitalize() + 'Atom', (onto.Atom, ))
Expand Down Expand Up @@ -143,4 +149,6 @@ class hasChemicalSymbol(onto.hasProperty):
onto._abbreviate(version_iri))

# Save new ontology as turtle
onto.save(os.path.join(thisdir, 'periodictable.ttl'), format='turtle', overwrite=True)
onto.save(
os.path.join(thisdir, 'periodictable.ttl'), format='turtle', overwrite=True
)
Loading

0 comments on commit 7473c66

Please sign in to comment.