Dear all,
I have an owl file with name resto.owl, and created a simple rule using
construct like this :
CONSTRUCT {
?s :price_type ?p .
}
WHERE {
?s :highest_price ?h .
BIND (IF((?h > 3000), "EXPENSIVE", "CHEAP") AS ?p) .
}
Using TBC, I have run a simple sparql in SPARQL editor:
SELECT ?a ?b
WHERE {
?s :resto_name ?a .
?s :price_type ?b .
}
All worked perfect!
The problem is,
when I executed the same sparql using SPIN API, I got the right newTriplessize
but with no result in Sparql query.
Any help or hint will be appreciated.
Thanks.
This is my JSP script :
SPINModuleRegistry.get().init();
Model baseModel =
ModelFactory.createDefaultModel(ReificationStyle.Minimal);
baseModel.read("http://localhost/resto.owl");
String vResult = "";
String query = "";
// Create OntModel with imports
OntModel ontModel =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, baseModel);
// Create and add Model for inferred triples
Model newTriples =
ModelFactory.createDefaultModel(ReificationStyle.Minimal);
ontModel.addSubModel(newTriples);
// Register locally defined functions
SPINModuleRegistry.get().registerAll(ontModel, null);
// Run all inferences
SPINInferences.run(ontModel, newTriples, null, null, false, null);
vResult = " Found : " + String.valueOf(newTriples.size()) + "
triples <br/> "
+ "This is the data <br/><table border='1'>";
query = ""
+ " select ?a ?b "
+ " where { "
+ " ?s :resto_name ?a . "
+ " ?s :price_type ?b . "
+ " } ";
Query arqQuery = ARQFactory.get().createQuery(baseModel, query);
QueryExecution qexec =
ARQFactory.get().createQueryExecution(arqQuery, baseModel);
try {
ResultSet rs = qexec.execSelect();
for (; rs.hasNext();) {
QuerySolution qs = rs.nextSolution();
vResult += "<tr><td> "+
qs.getLiteral("a").getValue().toString() + "</td>";
vResult += "<td> "+
qs.getLiteral("b").getValue().toString() + "</td>";
vResult += "</tr>";
}
vResult += "</table>";
} finally {
qexec.close();
}
--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
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].
For more options, visit https://groups.google.com/groups/opt_out.