Skip to content

Commit

Permalink
Fetch hardcoded namespaces from tripper (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis authored May 25, 2024
1 parent 2d00ee5 commit aeb5588
Showing 1 changed file with 18 additions and 17 deletions.
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

0 comments on commit aeb5588

Please sign in to comment.