Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.0.0-beta5' into holistic_top_l…
Browse files Browse the repository at this point in the history
…evel
  • Loading branch information
emanueleghedini committed Jan 17, 2024
2 parents 3ceaf47 + 7473c66 commit d2d70dd
Show file tree
Hide file tree
Showing 2 changed files with 837 additions and 830 deletions.
18 changes: 13 additions & 5 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,8 +84,10 @@ class hasChemicalSymbol(onto.hasProperty):

print(Z, symbol, name, mass)

Element = types.new_class(name.capitalize() + 'Symbol', (onto.ChemicalElement, ))
Element.is_a.append(onto.hasSymbolData.value(symbol))
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, ))
AtomClass.elucidation.append(en('Atom subclass for %s.' % name.lower()))
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 d2d70dd

Please sign in to comment.