Skip to content

Commit

Permalink
Merge pull request #6 from emmo-repo/resolvable-url-for-emmo
Browse files Browse the repository at this point in the history
Ensure that we can open the ontology from url
  • Loading branch information
francescalb authored May 7, 2021
2 parents 0a34b8c + 29e8ebe commit 5d5dbb1
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 40 deletions.
51 changes: 26 additions & 25 deletions atomistic.ttl
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
@prefix : <http://emmo.info/atomistic#> .
@prefix : <http://emmo.info/domain-atomistic#> .
@prefix core: <http://www.w3.org/2004/02/skos/core#> .
@prefix emmo: <http://emmo.info/emmo#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix term: <http://purl.org/dc/terms/> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://emmo.info/atomistic> a owl:Ontology ;
<http://emmo.info/domain-atomistic> a owl:Ontology ;
emmo:EMMO_5525a055_dda5_4556_8b91_f0d22fa676cc "https://creativecommons.org/licenses/by/4.0/legalcode"@en ;
term:abstract "An EMMO-based domain ontology for atomistic and electronic modelling.Atomistic is released under the Creative Commons Attribution 4.0 International license (CC BY 4.0)."@en ;
term:contributor "SINTEF"@en ;
Expand All @@ -23,65 +24,65 @@ email: [email protected]
Francesca L. Bleken
SINTEF
email: [email protected]"""@en,
"The EMMO requires FacT++ reasoner plugin in order to visualize allinferences and class hierarchy (ctrl+R hotkey in Protege)."@en,
"The EMMO requires FaCT++ reasoner plugin in order to visualize allinferences and class hierarchy (ctrl+R hotkey in Protege)."@en,
"This ontology is generated with data from the ASE Python package."@en ;
owl:imports <https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/master/versions/1.0.0-beta/emmo-inferred-chemistry> ;
owl:versionIRI <http://emmo.info/0.0.1/atomistic> ;
owl:imports <https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/master/versions/1.0.0-beta/emmo-inferred-chemistry2.ttl> ;
owl:versionIRI <http://emmo.info/0.0.1/domain-atomistic> ;
owl:versionInfo "0.0.1"@en .

:atomistic_21c6ff70-4800-555e-b642-74ba2aaeb039 a owl:Class ;
<http://emmo.info/domain-atomistic#21c6ff70-4800-555e-b642-74ba2aaeb039> a owl:Class ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "Physical dimensionality of charge density."@en ;
rdfs:subClassOf emmo:EMMO_9895a1b4_f0a5_4167_ac5e_97db40b8bfcc ;
owl:equivalentClass [ a owl:Restriction ;
owl:hasValue "T+1 L-3 M0 I+1 Θ0 N0 J0"^^rdf:PlainLiteral ;
owl:onProperty emmo:EMMO_23b579e1_8088_45b5_9975_064014026c42 ] ;
core:prefLabel "ChargeDensityDimension"@en .

:atomistic_83a69cf2-00c1-58b8-915b-76cb3549890a a owl:Class ;
<http://emmo.info/domain-atomistic#83a69cf2-00c1-58b8-915b-76cb3549890a> a owl:Class ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 """An efficient computional method for solving the many-electron
(time-independent) Schrödinger equation."""@en ;
rdfs:subClassOf emmo:EMMO_6eca09be_17e9_445e_abc9_000aa61b7a11 ;
core:prefLabel "DensityFunctionalTheory"@en .

:atomistic_b65fe3b6-8477-5508-a066-2f7edcf25126 a owl:Class ;
:b65fe3b6-8477-5508-a066-2f7edcf25126 a owl:Class ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 """The Schrödinger equation for a fictious "Kohn-Sham" system of
non-interacting electrons that generates the same charge
density as the real interacting system."""@en ;
rdfs:comment "This is the equation that is solved with density functional theory."^^xsd:string ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty emmo:EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe ;
owl:someValuesFrom :atomistic_513b1e52-5e37-5ba0-b4cc-89369f9b41c5 ],
:atomistic_acaafcb6-b65f-5996-93ed-2f486f5f2b30 ;
owl:someValuesFrom <http://emmo.info/domain-atomistic#513b1e52-5e37-5ba0-b4cc-89369f9b41c5> ],
:acaafcb6-b65f-5996-93ed-2f486f5f2b30 ;
core:prefLabel "KohnShamEquation"@en .

:atomistic_fac61002-4a3d-5810-a430-ad5dad69c9a0 a owl:Class ;
:fac61002-4a3d-5810-a430-ad5dad69c9a0 a owl:Class ;
emmo:EMMO_21ae69b4_235e_479d_8dd8_4f756f694c1b "TimeDependentSchrödingerEquation"@en ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "The full time-dependent Schrödinger equation."@en ;
rdfs:subClassOf :atomistic_c4dd4450-cc80-5de4-a8d6-db0651115a2c ;
rdfs:subClassOf :c4dd4450-cc80-5de4-a8d6-db0651115a2c ;
core:prefLabel "TimeDependentSchrodingerEquation"@en .

:atomistic_08fd7117-66ac-5b6d-b65e-34a826675877 a owl:Class ;
<http://emmo.info/domain-atomistic#08fd7117-66ac-5b6d-b65e-34a826675877> a owl:Class ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "A mathematical operator with a physical interpretation."@en ;
rdfs:subClassOf emmo:EMMO_f6d0c26a_98b6_4cf8_8632_aa259131faaa ;
core:prefLabel "PhysicalOperator"@en .

:atomistic_42244404-98d1-582a-8fc0-3cdd2a9b3df6 a owl:Class ;
<http://emmo.info/domain-atomistic#42244404-98d1-582a-8fc0-3cdd2a9b3df6> a owl:Class ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 """An operator corresponding to the sum of the kinetic energies plus
the potential energies for all the particles in the system."""@en ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty :atomistic_42812fef-145a-56e9-9c18-72bd32214455 ;
owl:onProperty <http://emmo.info/domain-atomistic#42812fef-145a-56e9-9c18-72bd32214455> ;
owl:someValuesFrom emmo:EMMO_31ec09ba_1713_42cb_83c7_b38bf6f9ced2 ],
:atomistic_08fd7117-66ac-5b6d-b65e-34a826675877,
<http://emmo.info/domain-atomistic#08fd7117-66ac-5b6d-b65e-34a826675877>,
emmo:EMMO_6f5af708_f825_4feb_a0d1_a8d813d3022b ;
core:prefLabel "Hamiltonian"@en .

:atomistic_42812fef-145a-56e9-9c18-72bd32214455 a owl:ObjectProperty ;
<http://emmo.info/domain-atomistic#42812fef-145a-56e9-9c18-72bd32214455> a owl:ObjectProperty ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "Relates a mathematical (or physical) operator to its eigenvalue."@en ;
rdfs:domain emmo:EMMO_f6d0c26a_98b6_4cf8_8632_aa259131faaa ;
rdfs:subPropertyOf emmo:EMMO_e1097637_70d2_4895_973f_2396f04fa204 ;
core:prefLabel "hasEigenvalue"@en .

:atomistic_513b1e52-5e37-5ba0-b4cc-89369f9b41c5 a owl:Class ;
<http://emmo.info/domain-atomistic#513b1e52-5e37-5ba0-b4cc-89369f9b41c5> a owl:Class ;
emmo:EMMO_50c298c2_55a2_4068_b3ac_4e948c33181f "http://www.electropedia.org/iev/iev.nsf/display?openform&ievref=121-11-07"^^rdf:PlainLiteral ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 "Electric charge per volume."@en ;
emmo:EMMO_c84c6752_6d64_48cc_9500_e54a3c34898d "https://en.wikipedia.org/wiki/Charge_density"^^xsd:string ;
Expand All @@ -91,14 +92,14 @@ the potential energies for all the particles in the system."""@en ;
rdfs:subClassOf emmo:EMMO_2946d40b_24a1_47fa_8176_e3f79bb45064 ;
core:prefLabel "ChargeDensity"@en .

:atomistic_acaafcb6-b65f-5996-93ed-2f486f5f2b30 a owl:Class ;
:acaafcb6-b65f-5996-93ed-2f486f5f2b30 a owl:Class ;
emmo:EMMO_21ae69b4_235e_479d_8dd8_4f756f694c1b "TimeIndependentSchrödingerEquation"@en ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 """If the external potential does not depende on time, the Schrödinger
equation can be reduced to this time-independent form."""@en ;
rdfs:subClassOf :atomistic_c4dd4450-cc80-5de4-a8d6-db0651115a2c ;
rdfs:subClassOf :c4dd4450-cc80-5de4-a8d6-db0651115a2c ;
core:prefLabel "TimeIndependentSchrodingerEquation"@en .

:atomistic_df750ce7-fda1-5e9b-ba32-db96ec170577 a owl:Class ;
:df750ce7-fda1-5e9b-ba32-db96ec170577 a owl:Class ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 """A mathematical description of the quantum state of an isolated
quantum system. A wave function is a function of the degrees
of freedom corresponding to some maximal set of commuting
Expand All @@ -109,7 +110,7 @@ function can be derived from the quantum state."""@en ;
rdfs:subClassOf emmo:EMMO_a66427d1_9932_4363_9ec5_7d91f2bfda1e ;
core:prefLabel "WaveFunction"@en .

:atomistic_c4dd4450-cc80-5de4-a8d6-db0651115a2c a owl:Class ;
:c4dd4450-cc80-5de4-a8d6-db0651115a2c a owl:Class ;
emmo:EMMO_21ae69b4_235e_479d_8dd8_4f756f694c1b "SchrödingerEquation"@en ;
emmo:EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 """A linear partial differential equation describing the wave
function of a quantum-mechanical system.
Expand All @@ -120,13 +121,13 @@ time-dependent Schrödinger equation."""@en ;
emmo:EMMO_c84c6752_6d64_48cc_9500_e54a3c34898d "https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation"^^rdf:PlainLiteral ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty emmo:EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe ;
owl:someValuesFrom :atomistic_42244404-98d1-582a-8fc0-3cdd2a9b3df6 ],
owl:someValuesFrom :df750ce7-fda1-5e9b-ba32-db96ec170577 ],
[ a owl:Restriction ;
owl:onProperty emmo:EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe ;
owl:someValuesFrom :atomistic_df750ce7-fda1-5e9b-ba32-db96ec170577 ],
owl:someValuesFrom emmo:EMMO_31ec09ba_1713_42cb_83c7_b38bf6f9ced2 ],
[ a owl:Restriction ;
owl:onProperty emmo:EMMO_b2282816_b7a3_44c6_b2cb_3feff1ceb7fe ;
owl:someValuesFrom emmo:EMMO_31ec09ba_1713_42cb_83c7_b38bf6f9ced2 ],
owl:someValuesFrom <http://emmo.info/domain-atomistic#42244404-98d1-582a-8fc0-3cdd2a9b3df6> ],
emmo:EMMO_27c5d8c6_8af7_4d63_beb1_ec37cd8b3fa3 ;
core:prefLabel "SchrodingerEquation"@en .

2 changes: 1 addition & 1 deletion catalog-v001.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group id="Folder Repository, directory=, recursive=true, Auto-Update=false, version=2" prefer="public" xml:base="">
<uri name="https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/master/versions/1.0.0-beta/emmo-inferred-chemistry" uri="https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/master/versions/1.0.0-beta/emmo-inferred-chemistry2.ttl"/>
<uri name="http://emmo.info/0.0.1/atomistic" uri=".atomistic.ttl"/>
<uri name="http://emmo.info/0.0.1/domain-atomistic" uri="atomistic.ttl"/>
</group>
</catalog>
40 changes: 26 additions & 14 deletions domain-atomistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,19 @@ def pl(s):


# Load crystallography, which imports emmo
crystallography_url = (
emmo_url = (
'https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/'
'master/versions/1.0.0-beta/emmo-inferred-chemistry2.ttl')
world = World()
cryst = world.get_ontology(crystallography_url)
cryst.load()
cryst.sync_python_names() # Syncronize annotations
cryst.base_iri = cryst.base_iri.rstrip('/#')
catalog_mappings = {cryst.base_iri: crystallography_url}

emmo = world.get_ontology(emmo_url)
emmo.load()
emmo.sync_python_names() # Syncronize annotations
emmo.base_iri = emmo.base_iri.rstrip('/#')
catalog_mappings = {emmo.base_iri: emmo_url}

# Create new ontology
onto = world.get_ontology('http://emmo.info/atomistic#')
onto.base_iri = 'http://emmo.info/atomistic#'
onto.imported_ontologies.append(cryst)
onto = world.get_ontology('http://emmo.info/domain-atomistic#')
onto.imported_ontologies.append(emmo)
onto.sync_python_names()


Expand Down Expand Up @@ -126,12 +124,12 @@ class KohnShamEquation(onto.TimeIndependentSchrodingerEquation):

# Save new ontology as owl
onto.sync_attributes(name_policy='uuid', class_docstring='elucidation',
name_prefix='atomistic_')
version_iri = "http://emmo.info/%s/atomistic" % __version__
name_prefix='')
version_iri = "http://emmo.info/%s/domain-atomistic" % __version__
onto.set_version(version_iri=version_iri)
onto.dir_label = False

catalog_mappings[version_iri] = '.atomistic.ttl'
catalog_mappings[version_iri] = 'atomistic.ttl'

#################################################################
# Annotate the ontology metadata
Expand All @@ -152,7 +150,7 @@ class KohnShamEquation(onto.TimeIndependentSchrodingerEquation):
'https://creativecommons.org/licenses/by/4.0/legalcode'))
onto.metadata.versionInfo.append(en(__version__))
onto.metadata.comment.append(en(
'The EMMO requires FacT++ reasoner plugin in order to visualize all'
'The EMMO requires FaCT++ reasoner plugin in order to visualize all'
'inferences and class hierarchy (ctrl+R hotkey in Protege).'))
onto.metadata.comment.append(en(
'This ontology is generated with data from the ASE Python package.'))
Expand All @@ -172,3 +170,17 @@ class KohnShamEquation(onto.TimeIndependentSchrodingerEquation):
write_catalog(catalog_mappings)
# onto.sync_reasoner()
# onto.save('atomistic-inferred.ttl', overwrite=True)


# Manually change url of EMMO to `emmo_url` when importing it to make
# it resolvable without consulting the catalog file. This makes it possible
# to open the ontology from url in Protege
import rdflib # noqa: E402, F401
g = rdflib.Graph()
g.parse('atomistic.ttl', format='turtle')
for s, p, o in g.triples(
(None, rdflib.URIRef('http://www.w3.org/2002/07/owl#imports'), None)):
if 'emmo-inferred' in o:
g.remove((s, p, o))
g.add((s, p, rdflib.URIRef(emmo_url)))
g.serialize(destination='atomistic.ttl', format='turtle')

0 comments on commit 5d5dbb1

Please sign in to comment.