-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Upd] Add support for the merged cells in the xls files in TabularMod…
…ule.
- Loading branch information
Showing
9 changed files
with
312 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
s-pipes-modules/module-tabular/src/main/java/cz/cvut/spipes/modules/model/Cell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package cz.cvut.spipes.modules.model; | ||
|
||
import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty; | ||
import cz.cvut.kbss.jopa.model.annotations.OWLClass; | ||
import cz.cvut.spipes.constants.CSVW; | ||
import cz.cvut.spipes.constants.KBSS_CSVW; | ||
import cz.cvut.spipes.modules.util.TabularModuleUtils; | ||
|
||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
@OWLClass(iri = CSVW.CellUri) | ||
public class Cell extends AbstractEntity{ | ||
public Cell() {} | ||
|
||
public Cell(String cellUri) { | ||
try { | ||
this.setUri(new URI(cellUri)); | ||
} catch (URISyntaxException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@OWLAnnotationProperty(iri = CSVW.nameUri) | ||
private String name; | ||
|
||
@OWLAnnotationProperty(iri = CSVW.RowUri) | ||
private String rowName; | ||
|
||
@OWLAnnotationProperty(iri = CSVW.ColumnUri) | ||
private String columnName; | ||
|
||
@OWLAnnotationProperty(iri = KBSS_CSVW.sameValueAsUri) | ||
private String sameValueAsCell; | ||
|
||
private final transient TabularModuleUtils tabularModuleUtils = new TabularModuleUtils(); | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getSameValueAsCell() { | ||
return sameValueAsCell; | ||
} | ||
|
||
public void setSameValueAsCell(String sameValueAsCell) { | ||
this.sameValueAsCell = sameValueAsCell; | ||
} | ||
|
||
public void setRowName(String rowName) { | ||
tabularModuleUtils.setVariable(this.rowName, rowName, value -> this.rowName = value, "rowName"); | ||
} | ||
|
||
public String getRowName() { | ||
return rowName; | ||
} | ||
|
||
public void setColumnName(String columnName) { | ||
tabularModuleUtils.setVariable(this.columnName, columnName, value -> this.columnName = value, "columnName"); | ||
} | ||
|
||
public String getColumnName() { | ||
return columnName; | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
s-pipes-modules/module-tabular/src/main/java/cz/cvut/spipes/modules/model/Region.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package cz.cvut.spipes.modules.model; | ||
|
||
public class Region { | ||
private int firstRow; | ||
private int lastRow; | ||
private int firstColumn; | ||
private int lastColumn; | ||
public Region(int firstRow, int firstColumn, int lastRow, int lastColumn) { | ||
this.firstRow = firstRow; | ||
this.firstColumn = firstColumn; | ||
this.lastRow = lastRow; | ||
this.lastColumn = lastColumn; | ||
} | ||
|
||
public int getFirstRow() { | ||
return firstRow; | ||
} | ||
|
||
public void setFirstRow(int firstRow) { | ||
this.firstRow = firstRow; | ||
} | ||
|
||
public int getLastRow() { | ||
return lastRow; | ||
} | ||
|
||
public void setLastRow(int lastRow) { | ||
this.lastRow = lastRow; | ||
} | ||
|
||
public int getFirstColumn() { | ||
return firstColumn; | ||
} | ||
|
||
public void setFirstColumn(int firstColumn) { | ||
this.firstColumn = firstColumn; | ||
} | ||
|
||
public int getLastColumn() { | ||
return lastColumn; | ||
} | ||
|
||
public void setLastColumn(int lastColumn) { | ||
this.lastColumn = lastColumn; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
s-pipes-modules/module-tabular/src/test/resources/merged-xls-model-output.ttl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<http://example.org/cell5> | ||
a <http://www.w3.org/ns/csvw#Cell> ; | ||
<http://www.w3.org/ns/csvw#Column> | ||
_:b0 ; | ||
<http://www.w3.org/ns/csvw#Row> | ||
<http://test-file#row-4> ; | ||
<https://onto.fel.cvut.cz/ontologies/extension/csvw/same-value-as> | ||
<http://example.org/cell4> . | ||
|
||
_:b0 a <http://www.w3.org/ns/csvw#Column> ; | ||
<http://www.w3.org/ns/csvw#name> | ||
"aa" ; | ||
<http://www.w3.org/ns/csvw#propertyUrl> | ||
"http://onto.fel.cvut.cz/data/aa" ; | ||
<http://www.w3.org/ns/csvw#title> | ||
"aa" ; | ||
<https://onto.fel.cvut.cz/ontologies/extension/csvw/property> | ||
<http://onto.fel.cvut.cz/data/aa> . | ||
|
||
<http://test-file#row-4> | ||
<http://onto.fel.cvut.cz/data/bb> | ||
"ff" ; | ||
<http://onto.fel.cvut.cz/data/cc> | ||
"gg" . | ||
|
||
<http://example.org/cell4> | ||
a <http://www.w3.org/ns/csvw#Cell> ; | ||
<http://www.w3.org/ns/csvw#Column> | ||
_:b0 ; | ||
<http://www.w3.org/ns/csvw#Row> | ||
<http://test-file#row-3> . | ||
|
||
[ 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/2000/01/rdf-schema#label> | ||
"Sheet1" ; | ||
<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-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-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 , _:b0 , _:b2 ; | ||
<http://www.w3.org/ns/csvw#columns> | ||
( _:b0 | ||
_:b2 | ||
_:b1 | ||
) | ||
] ; | ||
<http://www.w3.org/ns/csvw#url> | ||
<http://test-file> | ||
] | ||
] . | ||
|
||
<http://test-file#row-3> | ||
<http://onto.fel.cvut.cz/data/aa> | ||
"merged rows" ; | ||
<http://onto.fel.cvut.cz/data/bb> | ||
"dd" ; | ||
<http://onto.fel.cvut.cz/data/cc> | ||
"ee" . | ||
|
||
<http://example.org/cell3> | ||
a <http://www.w3.org/ns/csvw#Cell> ; | ||
<http://www.w3.org/ns/csvw#Column> | ||
_:b1 ; | ||
<http://www.w3.org/ns/csvw#Row> | ||
<http://test-file#row-2> ; | ||
<https://onto.fel.cvut.cz/ontologies/extension/csvw/same-value-as> | ||
<http://example.org/cell1> . | ||
|
||
<http://test-file#row-2> | ||
<http://onto.fel.cvut.cz/data/aa> | ||
"merged columns" . | ||
|
||
<http://example.org/cell2> | ||
a <http://www.w3.org/ns/csvw#Cell> ; | ||
<http://www.w3.org/ns/csvw#Column> | ||
_:b2 ; | ||
<http://www.w3.org/ns/csvw#Row> | ||
<http://test-file#row-2> ; | ||
<https://onto.fel.cvut.cz/ontologies/extension/csvw/same-value-as> | ||
<http://example.org/cell1> . | ||
|
||
<http://example.org/cell1> | ||
a <http://www.w3.org/ns/csvw#Cell> ; | ||
<http://www.w3.org/ns/csvw#Column> | ||
_:b0 ; | ||
<http://www.w3.org/ns/csvw#Row> | ||
<http://test-file#row-2> . | ||
|
||
_:b2 a <http://www.w3.org/ns/csvw#Column> ; | ||
<http://www.w3.org/ns/csvw#name> | ||
"bb" ; | ||
<http://www.w3.org/ns/csvw#propertyUrl> | ||
"http://onto.fel.cvut.cz/data/bb" ; | ||
<http://www.w3.org/ns/csvw#title> | ||
"bb" ; | ||
<https://onto.fel.cvut.cz/ontologies/extension/csvw/property> | ||
<http://onto.fel.cvut.cz/data/bb> . | ||
|
||
_:b1 a <http://www.w3.org/ns/csvw#Column> ; | ||
<http://www.w3.org/ns/csvw#name> | ||
"cc" ; | ||
<http://www.w3.org/ns/csvw#propertyUrl> | ||
"http://onto.fel.cvut.cz/data/cc" ; | ||
<http://www.w3.org/ns/csvw#title> | ||
"cc" ; | ||
<https://onto.fel.cvut.cz/ontologies/extension/csvw/property> | ||
<http://onto.fel.cvut.cz/data/cc> . |
Binary file not shown.