Skip to content
Open
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
23 changes: 23 additions & 0 deletions tests/datadoc/test_tabledoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,28 @@ def test_csv():

from tripper import Triplestore
from tripper.datadoc import TableDoc
from tripper.datadoc.context import get_context

context = get_context(theme="ddoc:datadoc")
context.add_context(
{
"ssbd": "http://w3id.org/ssbd/",
"prov": "http://www.w3.org/ns/prov#",
"wasDerivedFrom": {
"@id": "prov:wasDerivedFrom",
"@type": "@id",
},
"ssbd:wasDerivedFrom": {
"@id": "ssbd:wasDerivedFrom",
"@type": "@id",
},
}
)

# Read csv file
td = TableDoc.parse_csv(
indir / "semdata.csv",
context=context,
prefixes={
"sem": "https://w3id.com/emmo/domain/sem/0.1#",
"semdata": "https://he-matchmaker.eu/data/sem/",
Expand All @@ -135,6 +153,7 @@ def test_csv():
"dm": "http://onto-ns.com/meta/characterisation/0.1/SEMImage#",
"par": "http://sintef.no/dlite/parser#",
"gen": "http://sintef.no/dlite/generator#",
"prov": "http://www.w3.org/ns/prov#",
},
)

Expand All @@ -144,6 +163,9 @@ def test_csv():
assert img["@id"] == (
"semdata:SEM_cement_batch2/77600-23-001/77600-23-001_5kV_400x_m001"
)
assert (
img["prov:wasDerivedFrom"] == "semdata:SEM_cement_batch2/77600-23-001"
)
assert img["distribution"]["downloadURL"] == (
"https://github.com/EMMC-ASBL/tripper/raw/refs/heads/master/"
"tests/input/77600-23-001_5kV_400x_m001.tif"
Expand All @@ -162,6 +184,7 @@ def test_csv():
td2 = TableDoc.parse_csv(
f,
delimiter=",",
context=context,
prefixes={
"sem": "https://w3id.com/emmo/domain/sem/0.1#",
"semdata": "https://he-matchmaker.eu/data/sem/",
Expand Down
10 changes: 5 additions & 5 deletions tests/input/semdata.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@id,@type,title,description,creator.name,contactPoint.hasName,inSeries,datamodel,datamodelStorage,distribution.downloadURL,distribution.mediaType,distribution.parser,isDescriptionFor
semdata:SEM_cement_batch2/77600-23-001/77600-23-001_5kV_400x_m001,sem:SEMImage,SEM image of cement,"Back-scattered SEM image of cement sample 77600 from Heidelberg, polished with 1 µm diamond compound.",Sigurd Wenner,Sigurd Wenner <Sigurd.Wenner@sintef.no>,semdata:SEM_cement_batch2/77600-23-001,http://onto-ns.com/meta/matchmaker/0.2/SEMImage,https://github.com/HEU-MatCHMaker/DataDocumentation/blob/master/SEM/datamodels/SEMImage.yaml,https://github.com/EMMC-ASBL/tripper/raw/refs/heads/master/tests/input/77600-23-001_5kV_400x_m001.tif,https://www.iana.org/assignments/media-types/image/tiff,par:sem_hitachi,mat:concrete1
semdata:SEM_cement_batch2/77600-23-001,sem:SEMImageSeries,Series of SEM image of cement sample 77600,"Back-scattered SEM image of cement sample 77600, polished with 1 µm diamond compound.",Sigurd Wenner,Sigurd Wenner <Sigurd.Wenner@sintef.no>,semdata:SEM_cement_batch2, ,,sftp://nas.aimen.es/P_MATCHMAKER_SHARE_SINTEF/SEM_cement_batch2/77600-23-001,https://www.iana.org/assignments/media-types/inode/directory,,
semdata:SEM_cement_batch2,sem:SEMImageSeries,Nested series of SEM images of cement batch2,...,Sigurd Wenner,Sigurd Wenner <Sigurd.Wenner@sintef.no>, ,,,sftp://nas.aimen.es/P_MATCHMAKER_SHARE_SINTEF/SEM_cement_batch2,https://www.iana.org/assignments/media-types/inode/directory,,
sample:SEM_cement_batch2/77600-23-001,chameo:Sample,Series for SEM images for sample 77600-23-001., ,,,,,,,,,
@id,@type,title,description,creator.name,contactPoint.hasName,inSeries,datamodel,datamodelStorage,distribution.downloadURL,distribution.mediaType,distribution.parser,isDescriptionFor,prov:wasDerivedFrom,https://w3id.org/ssbd/wasDerivedFrom
semdata:SEM_cement_batch2/77600-23-001/77600-23-001_5kV_400x_m001,sem:SEMImage,SEM image of cement,"Back-scattered SEM image of cement sample 77600 from Heidelberg, polished with 1 µm diamond compound.",Sigurd Wenner,Sigurd Wenner <Sigurd.Wenner@sintef.no>,semdata:SEM_cement_batch2/77600-23-001,http://onto-ns.com/meta/matchmaker/0.2/SEMImage,https://github.com/HEU-MatCHMaker/DataDocumentation/blob/master/SEM/datamodels/SEMImage.yaml,https://github.com/EMMC-ASBL/tripper/raw/refs/heads/master/tests/input/77600-23-001_5kV_400x_m001.tif,https://www.iana.org/assignments/media-types/image/tiff,par:sem_hitachi,mat:concrete1,semdata:SEM_cement_batch2/77600-23-001,semdata:SEM_cement_batch2/77600-23-001
semdata:SEM_cement_batch2/77600-23-001,sem:SEMImageSeries,Series of SEM image of cement sample 77600,"Back-scattered SEM image of cement sample 77600, polished with 1 µm diamond compound.",Sigurd Wenner,Sigurd Wenner <Sigurd.Wenner@sintef.no>,semdata:SEM_cement_batch2, ,,sftp://nas.aimen.es/P_MATCHMAKER_SHARE_SINTEF/SEM_cement_batch2/77600-23-001,https://www.iana.org/assignments/media-types/inode/directory,,,,
semdata:SEM_cement_batch2,sem:SEMImageSeries,Nested series of SEM images of cement batch2,...,Sigurd Wenner,Sigurd Wenner <Sigurd.Wenner@sintef.no>, ,,,sftp://nas.aimen.es/P_MATCHMAKER_SHARE_SINTEF/SEM_cement_batch2,https://www.iana.org/assignments/media-types/inode/directory,,,,
sample:SEM_cement_batch2/77600-23-001,chameo:Sample,Series for SEM images for sample 77600-23-001., ,,,,,,,,,,,
Loading