parent.appendChild(eR);
}
else if (end instanceof Literal)
{
Literal l = (Literal)end;
ValueFactory f = dataRepo.getValueFactory();
URI r = f.createURI(l.getLabel());
if (r == null)
continue;
Element eR;
//serialize meta knowledge or not
eR = createResourceElement(fd, dataRepo, doc, sl, null, r, mqueryResults.get(value), Constants.DEFAULT_MAX_DEPTH, mres);
parent.appendChild(eR);
}
else if (end instanceof Statement)
{
String error = "Render Error: SPARQL query must end on node";
throw new ParserConfigurationException(error);
}
}
}else{
//return values without metadata
fr.inria.jfresnel.sparql.sesame.SPARQLSesameEvaluator fsse = new fr.inria.jfresnel.sparql.sesame.SPARQLSesameEvaluator();
fsse.setDataRepository(dataRepo);
Vector queryResults = fsse.evaluateQuery(new SPARQLQuery(query));
for (int k=0; k<queryResults.size(); k++) {
Object end = queryResults.get(k);
//resources++;
if (end instanceof Resource)
{
Resource r = (Resource)end;
Element eR = createResourceElement(fd, dataRepo, doc, sl, null, r, Constants.DEFAULT_MAX_DEPTH);
parent.appendChild(eR);
}
else if (end instanceof Literal)
{
Literal l = (Literal)end;
ValueFactory f = dataRepo.getValueFactory();
URI r = f.createURI(l.getLabel());
if (r == null)
continue;
Element eR = createResourceElement(fd, dataRepo, doc, sl, null, r, Constants.DEFAULT_MAX_DEPTH);
parent.appendChild(eR);
}
else if (end instanceof Statement)
{
String error = "Render Error: SPARQL query must end on node";
throw new ParserConfigurationException(error);
}
}
}
}
}
//still not extended to return results with metadata!
else if (renderLens.getFSLInstanceDomains() != null)
{
System.out.println("Rendering getFSLInstanceDomains()...");
FSLPath[] fid = renderLens.getFSLInstanceDomains();
SesameLens sl = (SesameLens)renderLens;
FSLSesameEvaluator fse = new FSLSesameEvaluator();
fse.setDataRepository(dataRepo);
for (int i = 0; i < fid.length; i++)
{
//resources ++;
Vector pathInstances = fse.evaluatePath(fid[i]);
for (int k=0; k<pathInstances.size(); k++) {
Object end = ((Vector)pathInstances.get(k)).get(0);
if (end instanceof Resource)
{
Resource r = (Resource)end;
Element eR = createResourceElement(fd, dataRepo, doc, sl, null, r, Constants.DEFAULT_MAX_DEPTH);
parent.appendChild(eR);
}
else if (end instanceof Literal)
{
Literal l = (Literal)end;
ValueFactory f = dataRepo.getValueFactory();
URI r = f.createURI(l.getLabel());
if (r == null)
continue;
Element eR = createResourceElement(fd, dataRepo, doc, sl, null, r, Constants.DEFAULT_MAX_DEPTH);
parent.appendChild(eR);
}
else if (end instanceof Statement)
{
String error = "Render Error: FSL path must end on node";
throw new ParserConfigurationException(error);
}
}
}
}
// I don't know if here it should be return metadata here !!!
else if (renderLens.getBasicInstanceDomains() != null)
{
System.out.println("Rendering getBasicInstanceDomains()...");
java.lang.String[] bid = renderLens.getBasicInstanceDomains();
SesameLens sl = (SesameLens)renderLens;
HashMap resSet = new HashMap();
for (int j = 0; j < bid.length; j++)
{
ValueFactory f = dataRepo.getValueFactory();
URI r = f.createURI(bid[j]);
if (r == null)
continue;
// Don't render resource twice (???)
if (resSet.containsKey(r))