for(Dimension dim:lstDimensions)
{
Resource component_1 = model.createResource();
model.add(root,ParserUtil.component,component_1);
Property prop = model.createProperty(ParserUtil.property + (dim.getConceptRef().toLowerCase().equals("time_period") ? "time" : dim.getConceptRef().toLowerCase()));
model.add(component_1,ParserUtil.dimension,prop);
model.add(prop,ParserUtil.type,ParserUtil.dimensionProperty);
model.add(prop,ParserUtil.type,ParserUtil.codedProperty);
model.add(prop,ParserUtil.rdfsDomain,ParserUtil.observation);
if(!dim.getCodeList().equals(""))
{
for(CodeList obj:lstCodeLists)
{
if(obj.getId().toString().equals(dim.getCodeList().toString()))
{
if(obj.getAgencyID().equals("SDMX"))
{
// re-use the URI from sdmx-code.ttl file
String codeList = getCodeList(obj.getId());
Property cList = model.createProperty(ParserUtil.sdmx_code + codeList);
model.add(prop,ParserUtil.codeList,cList);
model.add(prop,ParserUtil.rdfsRange,ParserUtil.skosConcept);
Property cncpt = model.createProperty(ParserUtil.sdmx_concept + codeList);
model.add(prop,ParserUtil.concept,cncpt);
}
else
{
Property cList = model.createProperty(ParserUtil.dicURI + obj.getId().substring(obj.getId().indexOf("_")+1).toLowerCase());
model.add(prop,ParserUtil.codeList,cList);
model.add(prop,ParserUtil.rdfsRange,ParserUtil.skosConcept);
Property cncpt = model.createProperty(ParserUtil.concepts + (dim.getConceptRef().toLowerCase().equals("time_period") ? "time" : dim.getConceptRef().toLowerCase()));
model.add(prop,ParserUtil.concept,cncpt);
}
}
}
}
else
{
Property type = model.createProperty(ParserUtil.xsd + dim.getDataType().toLowerCase());
model.add(prop,ParserUtil.rdfsRange,type);
}
}
if(!obsValue.equals(""))
{
Resource component_1 = model.createResource();
model.add(root,ParserUtil.component,component_1);
Property prop = model.createProperty(ParserUtil.sdmx_measure + obsValue);
model.add(component_1,ParserUtil.dimension,prop);
}
if(!freq.equals(""))
{
Resource component_1 = model.createResource();
model.add(root,ParserUtil.component,component_1);
Property prop = model.createProperty(ParserUtil.sdmx_dimension + freq);
model.add(component_1,ParserUtil.dimension,prop);
}
if(!timePeriod.equals(""))
{
Resource component_1 = model.createResource();
model.add(root,ParserUtil.component,component_1);
Property prop = model.createProperty(ParserUtil.dcterms + "date");
model.add(component_1,ParserUtil.dimension,prop);
}
//
for(Dimension dim:lstTimeDimensions)
{
Resource component_1 = model.createResource();
model.add(root,ParserUtil.component,component_1);
Property prop = model.createProperty(ParserUtil.property + (dim.getConceptRef().toLowerCase().equals("time_period") ? "time" : dim.getConceptRef().toLowerCase()));
model.add(component_1,ParserUtil.dimension,prop);
model.add(prop,ParserUtil.type,ParserUtil.dimensionProperty);
model.add(prop,ParserUtil.rdfsDomain,ParserUtil.observation);
if(!dim.getCodeList().equals(""))
{
for(CodeList obj:lstCodeLists)
{
if(obj.getId().toString().equals(dim.getCodeList().toString()))
{
if(obj.getAgencyID().equals("SDMX"))
{
String codeList = getCodeList(obj.getId());
Property cList = model.createProperty(ParserUtil.sdmx_code + codeList);
model.add(prop,ParserUtil.codeList,cList);
model.add(prop,ParserUtil.rdfsRange,ParserUtil.skosConcept);
Property cncpt = model.createProperty(ParserUtil.sdmx_concept + codeList);
model.add(prop,ParserUtil.concept,cncpt);
}
else
{
Property cList = model.createProperty(ParserUtil.dicURI + obj.getId().substring(obj.getId().indexOf("_")+1).toLowerCase());
model.add(prop,ParserUtil.codeList,cList);
model.add(prop,ParserUtil.rdfsRange,ParserUtil.skosConcept);
Property cncpt = model.createProperty(ParserUtil.concepts + (dim.getConceptRef().toLowerCase().equals("time_period") ? "time" : dim.getConceptRef().toLowerCase()));
model.add(prop,ParserUtil.concept,cncpt);
}
}
}
}
else
{
Property type = model.createProperty(ParserUtil.xsd + dim.getDataType().toLowerCase());
model.add(prop,ParserUtil.rdfsRange,type);
}
}
//
for(Measure measure:lstMeasures)
{
Resource component_1 = model.createResource();
model.add(root,ParserUtil.component,component_1);
Property prop = model.createProperty(ParserUtil.property + (measure.getConceptRef().toLowerCase().equals("time_period") ? "time" : measure.getConceptRef().toLowerCase()));
model.add(component_1,ParserUtil.measure,prop);
model.add(prop,ParserUtil.type,ParserUtil.measureProperty);
model.add(prop,ParserUtil.type,ParserUtil.codedProperty);
model.add(prop,ParserUtil.rdfsDomain,ParserUtil.observation);
if(!measure.getCodeList().equals(""))
{
for(CodeList obj:lstCodeLists)
{
if(obj.getId().toString().equals(measure.getCodeList().toString()))
{
if(obj.getAgencyID().equals("SDMX"))
{
String codeList = getCodeList(obj.getId());
Property cList = model.createProperty(ParserUtil.sdmx_code + codeList);
model.add(prop,ParserUtil.codeList,cList);
model.add(prop,ParserUtil.rdfsRange,ParserUtil.skosConcept);
Property cncpt = model.createProperty(ParserUtil.sdmx_concept + codeList);
model.add(prop,ParserUtil.concept,cncpt);
}
else
{
Property cList = model.createProperty(ParserUtil.dicURI + obj.getId().substring(obj.getId().indexOf("_")+1).toLowerCase());
model.add(prop,ParserUtil.codeList,cList);
model.add(prop,ParserUtil.rdfsRange,ParserUtil.skosConcept);
Property cncpt = model.createProperty(ParserUtil.concepts + (measure.getConceptRef().toLowerCase().equals("time_period") ? "time" : measure.getConceptRef().toLowerCase()));
model.add(prop,ParserUtil.concept,cncpt);
}
}
}
}
else
{
Property type = model.createProperty(ParserUtil.xsd + measure.getDataType().toLowerCase());
model.add(prop,ParserUtil.rdfsRange,type);
}
}
//
for(Attribute att:lstAttributes)
{
Resource component_1 = model.createResource();
model.add(root,ParserUtil.component,component_1);
Property prop = model.createProperty(ParserUtil.property + (att.getConceptRef().toLowerCase().equals("time_period") ? "time" : att.getConceptRef().toLowerCase()));
model.add(component_1,ParserUtil.attribute,prop);
model.add(prop,ParserUtil.type,ParserUtil.attributeProperty);
model.add(prop,ParserUtil.type,ParserUtil.codedProperty);
model.add(prop,ParserUtil.rdfsDomain,ParserUtil.observation);
for(CodeList obj:lstCodeLists)
{
if(obj.getId().toString().equals(att.getCodeList().toString()))
{
if(obj.getAgencyID().equals("SDMX"))
{
// re-use the URI from sdmx-code.ttl file
String codeList = getCodeList(obj.getId());
Property cList = model.createProperty(ParserUtil.sdmx_code + codeList);
model.add(prop,ParserUtil.codeList,cList);
model.add(prop,ParserUtil.rdfsRange,ParserUtil.skosConcept);
Property cncpt = model.createProperty(ParserUtil.sdmx_concept + codeList);
model.add(prop,ParserUtil.concept,cncpt);
}
else
{
Property cList = model.createProperty(ParserUtil.dicURI + obj.getId().substring(obj.getId().indexOf("_")+1).toLowerCase());
model.add(prop,ParserUtil.codeList,cList);
model.add(prop,ParserUtil.rdfsRange,ParserUtil.skosConcept);
Property cncpt = model.createProperty(ParserUtil.concepts + (att.getConceptRef().toLowerCase().equals("time_period") ? "time" : att.getConceptRef().toLowerCase()));
model.add(prop,ParserUtil.concept,cncpt);
}
}
}
}