Skip to content

Commit

Permalink
[Fix] Fix failing tests due to a missing class by adding new dependen…
Browse files Browse the repository at this point in the history
…cy. Use assertIsomorphic in tests instead of a non-emptiness check.
  • Loading branch information
rodionnv committed Sep 7, 2023
1 parent eceb559 commit 54352dc
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 4 deletions.
5 changes: 5 additions & 0 deletions s-pipes-modules/module-tabular/pom.xml
Expand Up @@ -62,6 +62,11 @@
<groupId>cz.cvut.kbss</groupId>
<artifactId>s-pipes-core</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Expand Up @@ -10,7 +10,10 @@
import cz.cvut.spipes.test.JenaTestUtils;
import cz.cvut.spipes.util.StreamResourceUtils;
import org.apache.jena.rdf.model.*;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.slf4j.Logger;
Expand Down Expand Up @@ -57,8 +60,9 @@ void executeWithSimpleTransformation() throws URISyntaxException, IOException {
);

ExecutionContext outputContext = module.executeSelf();
Model expectedModel = ModelFactory.createDefaultModel().read(getFilePath("countries_model.ttl").toString());

assertTrue(outputContext.getDefaultModel().size() > 0);
assertIsomorphic(outputContext.getDefaultModel(),expectedModel);
}

@Test
Expand All @@ -69,11 +73,13 @@ void executeWithSimpleTransformationXls() throws URISyntaxException, IOException
getFilePath("countries.xls"))
);
module.setSourceResourceFormat(ResourceFormat.EXCEL);
module.setProcessSpecificSheetInXLSFile(2);
module.setProcessSpecificSheetInXLSFile(1);

ExecutionContext outputContext = module.executeSelf();

assertTrue(outputContext.getDefaultModel().size() > 0);
Model expectedModel = ModelFactory.createDefaultModel().read(getFilePath("countries_model.ttl").toString());

assertIsomorphic(outputContext.getDefaultModel(),expectedModel);
}

@Test
Expand Down
117 changes: 117 additions & 0 deletions s-pipes-modules/module-tabular/src/test/resources/countries_model.ttl
@@ -0,0 +1,117 @@
<http://test-file#row-2>
<http://onto.fel.cvut.cz/data/countryCode>
"AD" ;
<http://onto.fel.cvut.cz/data/latitude>
"42.5" ;
<http://onto.fel.cvut.cz/data/longitude>
"1.6" ;
<http://onto.fel.cvut.cz/data/name>
"Andorra" .

<http://test-file#row-3>
<http://onto.fel.cvut.cz/data/countryCode>
"AE" ;
<http://onto.fel.cvut.cz/data/latitude>
"23.4" ;
<http://onto.fel.cvut.cz/data/longitude>
"53.8" ;
<http://onto.fel.cvut.cz/data/name>
"United Arab Emirates" .

<http://test-file#row-4>
<http://onto.fel.cvut.cz/data/countryCode>
"AF" ;
<http://onto.fel.cvut.cz/data/latitude>
"33.9" ;
<http://onto.fel.cvut.cz/data/longitude>
"67.7" ;
<http://onto.fel.cvut.cz/data/name>
"Afghanistan" .

_:b0 a <http://www.w3.org/ns/csvw#Column> ;
<http://www.w3.org/ns/csvw#name>
"name" ;
<http://www.w3.org/ns/csvw#propertyUrl>
"http://onto.fel.cvut.cz/data/name" ;
<http://www.w3.org/ns/csvw#title>
"name" ;
<https://onto.fel.cvut.cz/ontologies/extension/csvw/property>
<http://onto.fel.cvut.cz/data/name> .

_:b1 a <http://www.w3.org/ns/csvw#Column> ;
<http://www.w3.org/ns/csvw#name>
"longitude" ;
<http://www.w3.org/ns/csvw#propertyUrl>
"http://onto.fel.cvut.cz/data/longitude" ;
<http://www.w3.org/ns/csvw#title>
"longitude" ;
<https://onto.fel.cvut.cz/ontologies/extension/csvw/property>
<http://onto.fel.cvut.cz/data/longitude> .

_:b2 a <http://www.w3.org/ns/csvw#Column> ;
<http://www.w3.org/ns/csvw#name>
"countryCode" ;
<http://www.w3.org/ns/csvw#propertyUrl>
"http://onto.fel.cvut.cz/data/countryCode" ;
<http://www.w3.org/ns/csvw#title>
"countryCode" ;
<https://onto.fel.cvut.cz/ontologies/extension/csvw/property>
<http://onto.fel.cvut.cz/data/countryCode> .

_:b3 a <http://www.w3.org/ns/csvw#Column> ;
<http://www.w3.org/ns/csvw#name>
"latitude" ;
<http://www.w3.org/ns/csvw#propertyUrl>
"http://onto.fel.cvut.cz/data/latitude" ;
<http://www.w3.org/ns/csvw#title>
"latitude" ;
<https://onto.fel.cvut.cz/ontologies/extension/csvw/property>
<http://onto.fel.cvut.cz/data/latitude> .

[ a <http://www.w3.org/ns/csvw#TableGroup> ;
<http://www.w3.org/ns/csvw#table>
[ a <http://www.w3.org/ns/csvw#Table> ;
<http://www.w3.org/ns/csvw#row>
[ a <http://www.w3.org/ns/csvw#Row> ;
<http://www.w3.org/ns/csvw#describes>
<http://test-file#row-4> ;
<http://www.w3.org/ns/csvw#rownum>
"3"^^<http://www.w3.org/2001/XMLSchema#int> ;
<http://www.w3.org/ns/csvw#url>
<http://test-file#row=4>
] ;
<http://www.w3.org/ns/csvw#row>
[ a <http://www.w3.org/ns/csvw#Row> ;
<http://www.w3.org/ns/csvw#describes>
<http://test-file#row-2> ;
<http://www.w3.org/ns/csvw#rownum>
"1"^^<http://www.w3.org/2001/XMLSchema#int> ;
<http://www.w3.org/ns/csvw#url>
<http://test-file#row=2>
] ;
<http://www.w3.org/ns/csvw#row>
[ a <http://www.w3.org/ns/csvw#Row> ;
<http://www.w3.org/ns/csvw#describes>
<http://test-file#row-3> ;
<http://www.w3.org/ns/csvw#rownum>
"2"^^<http://www.w3.org/2001/XMLSchema#int> ;
<http://www.w3.org/ns/csvw#url>
<http://test-file#row=3>
] ;
<http://www.w3.org/ns/csvw#tableSchema>
[ a <http://www.w3.org/ns/csvw#TableSchema> ;
<http://www.w3.org/ns/csvw#aboutUrl>
"http://test-file#row-{_row}"^^<http://www.w3.org/ns/csvw#uriTemplate> ;
<http://www.w3.org/ns/csvw#column>
_:b1 , _:b3 , _:b0 , _:b2 ;
<http://www.w3.org/ns/csvw#columns>
( _:b2
_:b3
_:b1
_:b0
)
] ;
<http://www.w3.org/ns/csvw#url>
<http://test-file>
]
] .

0 comments on commit 54352dc

Please sign in to comment.