Skip to content

Commit

Permalink
add reference to dataflow in R dataset for sdmx 3. It will be used by…
Browse files Browse the repository at this point in the history
… the VTL engine R environment
  • Loading branch information
amattioc committed Mar 21, 2024
1 parent 9646b49 commit e79ea4f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240320-1037
20240321-1158
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class PortableDataSet<T> implements Serializable
private boolean errorFlag = false;
private boolean numeric = false;
private String errorObjects = null;
private String dataflow = null;

private DefaultTableModel model = null;

Expand All @@ -80,6 +81,14 @@ public <U extends T> PortableDataSet(List<PortableTimeSeries<U>> tslist) throws
setTimeSeries(tslist);
}

public String getDataflow() {
return dataflow;
}

public void setDataflow(String dataflow) {
this.dataflow = dataflow;
}

/**
* Returns the index of a column in this dataset given its name.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,10 @@ public static PortableDataSet<Double> getTimeSeriesTable2(String provider, Strin
String attributes, String measures, String updatedAfter, boolean includeHistory)
throws SdmxException, DataStructureException
{
return new PortableDataSet<>(getTimeSeries2(provider, dataflow, tsKey, filter, startTime, endTime, attributes, measures, updatedAfter, includeHistory));

PortableDataSet<Double> ds = new PortableDataSet<>(getTimeSeries2(provider, dataflow, tsKey, filter, startTime, endTime, attributes, measures, updatedAfter, includeHistory));
ds.setDataflow(getFlow(provider, dataflow).getFullIdentifier());
return(ds);
}

//valid for sdmx v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ else if (startElement.getName().getLocalPart().equals(OBS) && data)
else if (event.isEndElement() && event.asEndElement().getName().getLocalPart() == (SERIES))
{
PortableTimeSeries<Double> ts = new PortableTimeSeries<>(dataflow, metadata.getKey(), metadata.getValue(), obs);
ts.getAttributesMap().put("dsd", dsd.getFullIdentifier());
tsList.putIfAbsent(ts.getName(), ts);
obs = new ArrayList<>();
}
Expand Down
2 changes: 2 additions & 0 deletions RJSDMX/R/TSConverter.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ convertTSList <- function (javaList, plain = F) {
# convert a java PortableDataSet
convertTSDF <- function (jtable) {
isNumeric <- .jcall(jtable,"Z","isNumeric");
dataflow <- .jcall(jtable,"Ljava/lang/String;","getDataflow");
time = .jcall(jtable,"[Ljava/lang/String;","getTimeStamps", evalString = TRUE, evalArray = TRUE)
values = .jcall(jtable,"[Ljava/lang/Object;","getObservations", evalArray = TRUE)
if(isNumeric){
Expand All @@ -110,6 +111,7 @@ convertTSDF <- function (jtable) {
warning('The results contain errors. Please check the ERROR_OBJECTS attribute')
}
attr(result, 'IS_NUMERIC') <- isNumeric
attr(result, 'dataflow') <- dataflow
return(result);
}

Expand Down
Binary file modified RJSDMX/inst/java/SDMX.jar
Binary file not shown.
Binary file modified STATA/jar/SDMX.jar
Binary file not shown.

0 comments on commit e79ea4f

Please sign in to comment.