Skip to content

Commit

Permalink
sdmx code file param added
Browse files Browse the repository at this point in the history
  • Loading branch information
aftiqb committed Feb 20, 2012
1 parent 6309d2a commit 877f6d5
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified institutions/Eurostat/parser/dist/EuroStat.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class DSDParser {
String baseURI = "http://eurostat.linked-statistics.org/";
static DataStoreModel dsModel;
public final String base_uri = "http://purl.org/linked-data/sdmx#";
public final String sdmx_codeFilePath = "sdmx-code/sdmx-code.ttl";
public static String sdmx_codeFilePath = "";
String obsValue = "";
String freq = "";
String timePeriod = "";
Expand Down Expand Up @@ -134,6 +134,7 @@ public void initObjects(){

public void parseFile()
{

addSDMXCodeList();
Element element = xmlDocument.getDocumentElement();
NodeList nl;
Expand Down Expand Up @@ -789,6 +790,7 @@ private static void usage()
System.out.println();
System.out.println(" -i inputFilePath Data Structure Definition (DSD) in XML format as input.");
System.out.println(" -o outputFilePath Output directory path to generate DataCube representation of DSD.");
System.out.println(" -a sdmx ttl file Path where the sdmx ttl is located.");
System.out.println(" (optional)-f format RDF format for serialization (RDF/XML, TURTLE, N-TRIPLES).");
}

Expand All @@ -802,6 +804,7 @@ public static void main(String[] args) throws Exception
options.addOption("i", "inputFilepath", true, "Data Structure Definition (DSD) in XML format as input.");
options.addOption("o", "outputFilePath", true, "Output directory path to generate DataCube representation of DSD.");
options.addOption("f", "format", true, "RDF format for serialization (RDF/XML, TURTLE, N-TRIPLES).");
options.addOption("a", "sdmx ttl file", true, "Path where the sdmx ttl is located.");
CommandLine commandLine = parser.parse( options, args );

if( commandLine.hasOption('h') ) {
Expand All @@ -816,7 +819,10 @@ public static void main(String[] args) throws Exception
if(commandLine.hasOption('f'))
serialization = commandLine.getOptionValue('f');

if(xmlFilePath.equals("") || outputFilePath.equals("") || serialization.equals(""))
if(commandLine.hasOption('a'))
sdmx_codeFilePath = commandLine.getOptionValue('a');

if(xmlFilePath.equals("") || outputFilePath.equals("") || serialization.equals("") || sdmx_codeFilePath.equals(""))
{
usage();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static void writeLog(String msg)
theLogger.info(msg);
}

public void runComparison(String inputFilePath, String outputFilePath, String logFilePath, String tempZipPath, String tempTsvPath, String tempDataPath, String dsdPath, String dataPath, String dataLogPath, String originalDataPath, String rawDataPath, String originalTsvPath)
public void runComparison(String inputFilePath, String outputFilePath, String logFilePath, String tempZipPath, String tempTsvPath, String tempDataPath, String dsdPath, String dataPath, String dataLogPath, String originalDataPath, String rawDataPath, String originalTsvPath, String sdmxTTLFile)
{
logger();

Expand Down Expand Up @@ -157,7 +157,7 @@ else if(!oldDate.equals("") && !newDate.equals(""))
unCompressZipFiles(tempZipPath, tempDataPath);

// rdfize the newly downloaded files
rdfize(dsdPath,dataPath, tempDataPath, dataLogPath, tempTsvPath);
rdfize(dsdPath,dataPath, tempDataPath, dataLogPath, tempTsvPath, sdmxTTLFile);

// move the newly downloaded zip, tsv and uncompressed files to their respective directories
moveFiles(tempZipPath, tempDataPath, originalDataPath, rawDataPath, tempTsvPath, originalTsvPath);
Expand Down Expand Up @@ -225,7 +225,7 @@ public void moveFiles(String tempZipPath, String tempDataPath, String originalDa

}

public void rdfize(String dsdPath, String dataPath, String tempDataPath, String dataLogPath, String tempTsvPath)
public void rdfize(String dsdPath, String dataPath, String tempDataPath, String dataLogPath, String tempTsvPath, String sdmxTTLFile)
{
writeLog("RDFizing updated datasets...");

Expand All @@ -246,6 +246,7 @@ public void rdfize(String dsdPath, String dataPath, String tempDataPath, String
dsd.xmlFilePath = f.getAbsolutePath();
dsd.outputFilePath = dsdPath;
dsd.serialization = "turtle";
dsd.sdmx_codeFilePath = sdmxTTLFile;
dsd.initObjects();
dsd.parseFile();
}
Expand Down Expand Up @@ -660,6 +661,8 @@ private static void usage()
System.out.println(" -p original data path Path where zip files will be stored.");
System.out.println(" -b original tsv path Path where tsv files will be stored.");
System.out.println(" -r raw data path Path where the uncompressed files will be stored.");
System.out.println(" -a sdmx ttl file Path where the sdmx ttl is located.");

}

public static void main(String[] args) throws Exception
Expand All @@ -676,6 +679,7 @@ public static void main(String[] args) throws Exception
String rawDataPath = "";
String tempTsvPath = "";
String originalTSVPath = "";
String sdmxTTLFile = "";

CommandLineParser parser = new BasicParser( );
Options options = new Options( );
Expand All @@ -692,13 +696,17 @@ public static void main(String[] args) throws Exception
options.addOption("p", "original data path", true, "Path where zip files will be stored.");
options.addOption("b", "original tsv path", true, "Path where tsv files will be stored.");
options.addOption("r", "raw data path", true, "Path where the uncompressed files will be stored.");
options.addOption("a", "sdmx ttl file", true, "Path where the sdmx ttl is located.");
CommandLine commandLine = parser.parse( options, args );

if( commandLine.hasOption('h') ) {
usage();
return;
}

if(commandLine.hasOption('a'))
sdmxTTLFile = commandLine.getOptionValue('a');

if(commandLine.hasOption('i'))
inputFilePath = commandLine.getOptionValue('i');

Expand Down Expand Up @@ -735,15 +743,15 @@ public static void main(String[] args) throws Exception
if(commandLine.hasOption('v'))
tempTsvPath = commandLine.getOptionValue('v');

if(tempTsvPath.equals("") || originalTSVPath.equals("") || inputFilePath.equals("") || outputFilePath.equals("") || logFilePath.equals("") || tempZipPath.equals("") || tempDataPath.equals("") || dsdPath.equals("") || dataPath.equals("") || dataLogPath.equals("") || originalDataPath.equals("") || rawDataPath.equals(""))
if(tempTsvPath.equals("") || originalTSVPath.equals("") || inputFilePath.equals("") || outputFilePath.equals("") || logFilePath.equals("") || tempZipPath.equals("") || tempDataPath.equals("") || dsdPath.equals("") || dataPath.equals("") || dataLogPath.equals("") || originalDataPath.equals("") || rawDataPath.equals("") || sdmxTTLFile.equals(""))
{
usage();
return;
}
else
{
DiffToC obj = new DiffToC();
obj.runComparison(inputFilePath,outputFilePath,logFilePath, tempZipPath, tempTsvPath, tempDataPath, dsdPath, dataPath, dataLogPath, originalDataPath, rawDataPath, originalTSVPath);
obj.runComparison(inputFilePath,outputFilePath,logFilePath, tempZipPath, tempTsvPath, tempDataPath, dsdPath, dataPath, dataLogPath, originalDataPath, rawDataPath, originalTSVPath, sdmxTTLFile);
}

}
Expand Down

0 comments on commit 877f6d5

Please sign in to comment.