diff --git a/tests/datadoc/test_tabledoc.py b/tests/datadoc/test_tabledoc.py index c85e381d..c32bbcb7 100644 --- a/tests/datadoc/test_tabledoc.py +++ b/tests/datadoc/test_tabledoc.py @@ -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/", @@ -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#", }, ) @@ -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" @@ -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/", diff --git a/tests/input/semdata.csv b/tests/input/semdata.csv index 2a5c0baa..ab897588 100644 --- a/tests/input/semdata.csv +++ b/tests/input/semdata.csv @@ -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 ,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 ,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 , ,,,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 ,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 ,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 , ,,,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., ,,,,,,,,,,,