Hi Martynas,

 On 26/06/12 00:42, Martynas Jusevičius wrote:
Hey list,

I have such code:

        log.debug("SPIN Query hasProperty(SP.orderBy): {}",
spinQuery.hasProperty(SP.orderBy));
        log.debug("SPIN Query Model size(): {}", spinQuery.getModel().size());
        log.debug("spinQuery.getRequiredProperty(SP.orderBy): {}",
spinQuery.getRequiredProperty(SP.orderBy));

        spinQuery.getRequiredProperty(SP.orderBy).remove(); // does not have 
effect?
        
        log.debug("SPIN Query hasProperty(SP.orderBy): {}",
spinQuery.hasProperty(SP.orderBy));
        log.debug("SPIN Query Model size(): {}", spinQuery.getModel().size());
        log.debug("spinQuery.getRequiredProperty(SP.orderBy): {}",
spinQuery.getRequiredProperty(SP.orderBy));

that produces such output:

01:35:30,218 DEBUG QueryBuilder:222 - SPIN Query hasProperty(SP.orderBy): true
01:35:30,220 DEBUG QueryBuilder:223 - SPIN Query Model size(): 927
01:35:30,233 DEBUG QueryBuilder:224 -
spinQuery.getRequiredProperty(SP.orderBy):
[http://graphity.org/ontology/SelectServices,
http://spinrdf.org/sp#orderBy, -1da81f99:13825fb9e2a:-47cd]
01:35:30,234 DEBUG FBRuleInfGraph:253 - Adding rule [ (?a
rdfs:isDefinedBy ?b) -> (?a rdfs:seeAlso ?b) ]
01:35:30,234 DEBUG FBRuleInfGraph:253 - Adding rule [ (?x
http://graphity.org/ontology/query ?y) -> (?y rdf:type
http://spinrdf.org/sp#Query) ]
01:35:30,235 DEBUG FBRuleInfGraph:253 - Adding rule [ (?x
http://graphity.org/ontology/service ?y) -> (?y rdf:type
http://www.w3.org/ns/sparql-service-description#Service) ]
01:35:30,235 DEBUG FBRuleInfGraph:253 - Adding rule [ (?x
http://graphity.org/ontology/mode ?y) -> (?y rdf:type
http://graphity.org/ontology/XSLTMode) ]
01:35:30,236 DEBUG FBRuleInfGraph:253 - Adding rule [ (?x
http://graphity.org/ontology/facebookApp ?y) -> (?y rdf:type
http://graph.facebook.com/schema/application#type) ]
01:35:30,236 DEBUG FBRuleInfGraph:253 - Adding rule [ (?x
http://graphity.org/ontology/apiKey ?y) -> (?y rdf:type xsd:string) ]
01:35:30,236 DEBUG FBRuleInfGraph:253 - Adding rule [ (?x
http://graphity.org/ontology/apiKey ?y) -> (?x rdf:type
http://www.w3.org/ns/sparql-service-description#Service) ]
01:35:30,237 DEBUG QueryBuilder:230 - SPIN Query hasProperty(SP.orderBy): true
01:35:30,238 DEBUG QueryBuilder:231 - SPIN Query Model size(): 927
01:35:30,239 DEBUG QueryBuilder:232 -
spinQuery.getRequiredProperty(SP.orderBy):
[http://graphity.org/ontology/SelectServices,
http://spinrdf.org/sp#orderBy, -1da81f99:13825fb9e2a:-47cd]

It doesn't seem that SP.orderBy gets removed? The model size stays at
927 and the property is clearly still present after remove() call.
It would be hard to construct a standalone example because SPIN code
is involved, but how is that even possible?

Without a standalone example it is hard to tell what is going on.

The FBRuleInfGraph calls suggests that spinQuery is actually stored in an inference model. That can make remove() behave oddly. For example if that statement is a deduction then removing it doesn't remove anything from the base model and the deduction remains.

Note that the statement seems to point to a bNode so a simple remove is probably not enough anyway.

> And why does FBRuleInfGraph get called?

Because spinQuery is in an InfGraph. If you didn't put in there then maybe SPIN did. Note that a createOntologyModel with no explicit OntModelSpec will default to a model with RDFS inference.

Dave

Reply via email to