}
if (rsSID.equals(rID))
{
// "normal" property specification
Format rf = sl.getBestFormatForProperty(fd, dataRepo, rs, useURI);
String pName = rp.toString();
Value o = rs.getObject();
String oName = null;
if (o instanceof Literal)
oName = ((Literal)o).getLabel();
else
oName = o.toString();
StyleFormatContainer sfc = new StyleFormatContainer(sl, rf, vResourceStyle, null);
if (lastValues == null)
{
// re-use values node where possible
Element eP = createPropertyElement(dataRepo, doc, sl, rf, pName, oName, sfc );
eR.appendChild(eP);
lastValues = getValuesElement(eP);
lastPredicate = rp;
}
String valueType = (rf == null) ? null : rf.getValueTypeName();
Element eV = createValueElement(doc, oName, valueType, sfc.vValueStyle);
//write Metadata of statement in XML Doc
try {
setMetaProperties(dataRepo, doc, sl, eV, getMetadata(dataRepo, rs), mres, mr, new MStatement(rs,getMetadata(dataRepo, rs)));
} catch (RepositoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
lastValues.appendChild(eV);
}
else
{
// if subject of statement not current lens,
// then a PropertyDescription resource
// :PropertyDescription a owl:Class ;
// rdfs:subClassOf rdfs:Resource ;
// rdfs:label "Property Description"@en ;
// rdfs:comment "More detailed description of the property, e.g. for specifing sublenses or merging properties."@en ;
// rdfs:subClassOf [
// a owl:Restriction ;
// owl:onProperty :property ;
// owl:allValuesFrom rdf:Property
// ] ;
// minCardinality = 0, maxCardinality = 1
// rdfs:subClassOf [
// a owl:Restriction ;
// owl:onProperty :sublens ;
// owl:minCardinality "0"^^dtype:nonNegativeInteger
// ] ;
// minCardinality = 0
// rdfs:subClassOf [
// a owl:Restriction ;
// owl:onProperty :depth ;
// owl:allValuesFrom dtype:nonNegativeInteger
// ] ;
// minCardinality = 0, maxCardinality = 1
// rdfs:subClassOf [
// a owl:Restriction ;
// owl:onProperty :use ;
// owl:allValuesFrom [ a owl:Class ;
// owl:unionOf ( :Group :Format ) ]
// ]
// minCardinality = 0, maxCardinality = 1
// .
SesameLens.PropertyDescriptionProperties pdp = sl.getPropertyDescriptionProperties(rs.getSubject(), fresnelRepository);
if (pdp.property == null)
continue;
// re-use values node where possible
Element eP = null;
Lens[] sublens = fd.getLenses(pdp.sublens);
// Target resource is object from original
// resource : fresnel:property : object statements
try {
RepositoryConnection connection = dataRepo.getConnection();
RepositoryResult<Statement> msl = connection.getStatements(r, null, null, true);
Statement sr;
while (msl.hasNext()){
sr = msl.next();
URI pr = sr.getPredicate();
if (pr.toString().equals(pdp.property)) {
Value no = sr.getObject();
String valueType = null;
StyleFormatContainer sfc = null;
if (eP == null){
// TODO: Is this right for getting styles?????
// TODO: Fresnel:use - should this be "used" here?
Format rf = sl.getBestFormatForProperty(fd, dataRepo, sr, pdp.use);
sfc = new StyleFormatContainer(sl, rf, vResourceStyle, null);
if (rf != null) valueType = rf.getValueTypeName();
eP = createPropertyElement(dataRepo, doc, sl, rf, pdp.property, null, sfc);
eR.appendChild(eP);
lastValues = getValuesElement(eP);
lastPredicate = rp;
}
if (no instanceof Resource){
// recurse!
// TODO: Is this right for getting styles?????
Resource rr = (Resource)no;
SesameLens jlr = (SesameLens)sl.selectRenderLens(dataRepo, sublens, rr);
Format rf = sl.getBestFormatForProperty(fd, dataRepo, sr, pdp.use);
sfc = new StyleFormatContainer(sl, rf, vResourceStyle, null);
Element eV = createValueElement(doc, null, valueType, sfc.vValueStyle);
//write Metadata of Statement in XML Doc
setMetaProperties(dataRepo, doc, sl, eV, getMetadata(dataRepo, sr), mres, mr, new MStatement(sr, getMetadata(dataRepo, sr)));