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

Update to w3id namespaces #838

Merged
merged 5 commits into from
May 25, 2024
Merged
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
35 changes: 18 additions & 17 deletions bindings/python/tests/test_property_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
try:
import rdflib
from pint import Quantity
from tripper import Triplestore
from tripper import DCTERMS, DM, FNO, MAP, RDF, RDFS, Triplestore
except ImportError as exc:
sys.exit(44) # exit code marking the test to be skipped

Expand Down Expand Up @@ -96,32 +96,33 @@ def isclose(a, b, rtol=1e-3):


# ---------------------------------------
r = np.array([10, 20, 30, 40, 50, 60]) # particle radius [nm]
n = np.array([1, 3, 7, 6, 2, 1]) # particle number density [1e21 #/m^3]
r = np.array([10., 20, 30, 40, 50, 60]) # particle radius [nm]
n = np.array([1., 3, 7, 6, 2, 1]) # particle number density [1e21 #/m^3]

rv = tm.Value(r, "nm", "inst1")
nv = tm.Value(n, "1/m^3", "inst2")


def average_radius(r, n):
"""Calculates average particle radius from arrays of particle radii
and number densities."""
return np.sum(r * n) / np.sum(n)


mapsTo = "http://emmo.info/domain-mappings#mapsTo"
instanceOf = "http://emmo.info/datamodel#instanceOf"
subClassOf = "http://www.w3.org/2000/01/rdf-schema#subClassOf"
# description = 'http://purl.org/dc/terms/description'
label = "http://www.w3.org/2000/01/rdf-schema#label"
hasUnit = "http://emmo.info/datamodel#hasUnit"
mapsTo = MAP.mapsTo
instanceOf = DM.instanceOf
subClassOf = RDFS.subClassOf
# description = DCTERMS.description
label = RDFS.label
hasUnit = DM.hasUnit
hasCost = ":hasCost"
RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
type = RDF + "type"
next = RDF + "next"
first = RDF + "first"
rest = RDF + "rest"
nil = RDF + "nil"
expects = "https://w3id.org/function/ontology#expects"
returns = "https://w3id.org/function/ontology#returns"
type = RDF.type
next = RDF.next
first = RDF.first
rest = RDF.rest
nil = RDF.nil
expects = FNO.expects
returns = FNO.returns


triples = [
Expand Down