Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change has value #121

Merged
merged 3 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.8.8
current_version = 0.8.9
commit = True
tag = False

Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ url: 'https://atomrdf.pyscal.org'
license: "MIT"
repository-code: https://github.com/pyscal/atomRDF
type: software
version: 0.8.8
version: 0.8.9
8 changes: 4 additions & 4 deletions atomrdf/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,9 @@ def add_calculated_quantity(self, sample, propertyname, value, unit=None):
prop = self.create_node(propertyname, CMSO.CalculatedProperty)
self.add((sample, CMSO.hasCalculatedProperty, prop))
self.add((prop, RDFS.label, Literal(propertyname)))
self.add((prop, CMSO.hasValue, Literal(value)))
self.add((prop, ASMO.hasValue, Literal(value)))
if unit is not None:
self.add((prop, CMSO.hasUnit, URIRef(f"http://qudt.org/vocab/unit/{unit}")))
self.add((prop, ASMO.hasUnit, URIRef(f"http://qudt.org/vocab/unit/{unit}")))

def inspect_sample(self, sample):
"""
Expand Down Expand Up @@ -670,8 +670,8 @@ def inspect_sample(self, sample):
[k[2] for k in self.triples((sample, CMSO.hasCalculatedProperty, None))]
)
props = list([self.value(prop_node, RDFS.label) for prop_node in prop_nodes])
propvals = list([self.value(d, CMSO.hasValue).toPython() for d in prop_nodes])
units = list([self.value(d, CMSO.hasUnit).toPython() for d in prop_nodes])
propvals = list([self.value(d, ASMO.hasValue).toPython() for d in prop_nodes])
units = list([self.value(d, ASMO.hasUnit).toPython() for d in prop_nodes])
st = []
st.append(f"Sample with {natoms} atoms.\n")
st.append("Material:\n")
Expand Down
2 changes: 2 additions & 0 deletions atomrdf/network/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ def read_ontology():
)

combo.add_path(("cmso:CalculatedProperty", "asmo:hasValue", "float"))
#combo.add_path(("cmso:CalculatedProperty", "asmo:hasUnit", "string"))
combo.add_path(("cmso:CalculatedProperty", "rdfs:label", "string"))
#how to handle units?

#input parameters for ASMO
combo.add_path(("asmo:InputParameter", "rdfs:label", "string"))
#combo.add_path(("cmso:CalculatedProperty", "asmo:hasUnit", "string"))
combo.add_path(("asmo:InputParameter", "asmo:hasValue", "float"))

#software agent
Expand Down
6 changes: 6 additions & 0 deletions atomrdf/network/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def patch_terms(iri, rn):
elif iri == "http://purls.helmholtz-metadaten.de/asmo/hasValue":
rn = ["float", "double", "int", "str"]

#elif iri == "http://purls.helmholtz-metadaten.de/asmo/hasUnit":
# rn = ["str"]

#elif iri == "http://purls.helmholtz-metadaten.de/cmso/hasUnit":
# rn = ["str"]

elif iri == "http://www.w3.org/2000/01/rdf-schema#label":
rn = ["str"]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='atomrdf',
version='0.8.8',
version='0.8.9',
author='Abril Azocar Guzman, Sarath Menon',
author_email='[email protected]',
description='Ontology based structural manipulation and quering',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from atomrdf import KnowledgeGraph, System
from atomrdf.namespace import CMSO, PLDO
from atomrdf.namespace import CMSO, PLDO, ASMO
import shutil

def test_structuregraph():
Expand Down Expand Up @@ -56,7 +56,7 @@ def test_add_quantity():
str(23),
unit='eV')
cp = s.value(sys.sample, CMSO.hasCalculatedProperty)
val = s.value(cp, CMSO.hasValue)
val = s.value(cp, ASMO.hasValue)
assert val.toPython() == '23'

insp = s.inspect_sample(sys.sample)
Expand Down
Loading