Hi everyone
I have been used
https://github.com/spinrdf/spinrdf/blob/master/src-examples/org/topbraid/spin/examples/SPINParsingExample.java
to generate SpinRDFModel from  SPARQL code and back.
However, when I want to parse back SpinModel with original SPARQL codes
with FILTER NOT EXISTS, it omits NOT Exists's elements. for Example :
CONSTRUCT
{
?a rdf:type ?x .
}
WHERE {
?a rdf:type ?x .
FILTER NOT EXISTS {?a rdf:type ?y .}
}

converts to spinModel correctly, but when I want to get toString() of
spinQuery , it returns :

CONSTRUCT {
?a a ?x .
}
WHERE {
?a a ?x .
FILTER <http://spinrdf.org/sp#notExists>([]) .
}

Similarly, this happens with a normal filter and it returns:
FILTER <http://spinrdf.org/sp#eq>(?a, 3)
Or
FILTER <http://spinrdf.org/sp#gt>(?a, 3)
Instead of
FILTER(?a=3)
Or
FILTER (?a>3)


My code is :

root = getRootOf(spinModel);//root has been found correctly
StmtIterator list = spinModel.listStatements(root,
ResourceFactory.createProperty("
http://www.w3.org/1999/02/22-rdf-syntax-ns#type";), (String) null);
        while (list.hasNext())  {
            Statement s = list.next();
            if (s.getObject().isResource() &&
s.getObject().asResource().equals(SP.CONSTRUCT))   {
                Construct spinQuery = s.getSubject().as(Construct.class);
                return spinQuery.toString();
            }
}

How to change my code to get the correct SPARQL code?

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/CAHhsRB36%3Deh-VOhhgKagcHDRmyK8R_fXm5NU4wO%3DxqwL5mm55w%40mail.gmail.com.

Reply via email to