On Monday 15 December 2008 18:15:38 Hugh Williams wrote:
> Can you provide a simple dataset and test program to recreate this
> problem, as it we can see the problem first hand then it can be fixed ?
Now I have tried to provide a minimal example all day to see if I can
reproduce the problem with a minimal amount of data, and a minimal servlet,
but I have failed.
The obvious way to produce the minimal dataset was to run the query against
the old endpoint, which would give me RDF/XML-ABBREV that represented the
expected graph. So that's what I did, and I have attached that expected file.
And guess what, when I stuff this into Virtuoso, it works just as expected
(except for the namespace prefixes, but they doesn't matter)!
When I reload my entire dataset, then it falls back to the old behaviour. In
this case, the serialisation which in RDF/XML-ABBREV is 6.4 KB becomes more
than 2 MB, so this is a big deal, and that's just surplus XML markup, it is
actually less data.
So, I have tried to load just smaller parts of the dataset, but that's been
unsuccessful too...
I'm not sure the problem is in any Virtuoso code at all. As previously stated,
I have verified that the model resulting from the query execution contains
the triples that are missing in the final serialised form. I attach a
stripped down version of the servlet that does the serialisation. As you can
see, there is some code there that's commented out that will list the
rdf:types. These are missing from the serialisation.
Even though I have failed to provide a stripped down example, this is all open
source and code and data are on the web. To load the whole dataset, you would
need:
https://submarine.computas.com/sublima/trunk/blocks/sublima-app/src/main/resources/rdf-data/sublima-ns.ttl
https://submarine.computas.com/sublima/trunk/blocks/sublima-app/src/main/resources/rdf-data/smil-test-data.ttl
https://submarine.computas.com/sublima/trunk/blocks/sublima-app/src/main/resources/rdf-data/lingvoj-excerpt.rdf
https://submarine.computas.com/sublima/trunk/blocks/sublima-app/src/main/resources/rdf-data/information-model.ttl
I used the following statements to import them:
SQL> ttlp (file_to_string_output
('/usr/local/src/sublima/blocks/sublima-app/src/main/resources/rdf-data/information-model.ttl'),
'http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/', 'smiltest',
0);
Done. -- 283 msec.
SQL> ttlp (file_to_string_output
('/usr/local/src/sublima/blocks/sublima-app/src/main/resources/rdf-data/smil-test-data.ttl'),
'http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/', 'smiltest',
0);
Done. -- 11990 msec.
SQL> ttlp (file_to_string_output
('/usr/local/src/sublima/blocks/sublima-app/src/main/resources/rdf-data/sublima-ns.ttl'),
'http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/', 'smiltest',
0);
Done. -- 33 msec.
SQL> DB.DBA.RDF_LOAD_RDFXML (file_to_string
('/usr/local/src/sublima/blocks/sublima-app/src/main/resources/rdf-data/lingvoj-excerpt.rdf'),
'http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/', 'smiltest');
The attached servlet can also be found in (a work in progress)
https://submarine.computas.com/mediasone-maven/trunk/backend/
I'm really sorry I couldn't find something that's easier to debug, but I
wanted to share the status with you nevertheless. I'll continue to work on
this problem.
Kind regards
Kjetil Kjernsmo
--
Senior Knowledge Engineer
Mobile: +47 986 48 234
Email: [email protected]
Web: http://www.computas.com/
| SHARE YOUR KNOWLEDGE |
Computas AS PO Box 482, N-1327 Lysaker | Phone:+47 6783 1000 | Fax:+47 6783
1001
<?xml version="1.0"?>
<rdf:RDF
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:lingvoj="http://www.lingvoj.org/ontology#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:user="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/user/"
xmlns:swrl="http://www.w3.org/2003/11/swrl#"
xmlns:resource="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/resource/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/"
xmlns:status="http://sublima.computas.com/status/"
xmlns:topic="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/"
xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
xmlns:p1="http://xmlns.computas.com/sublima-information-model#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:agent="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/agent/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:wdr="http://www.w3.org/2007/05/powder#"
xmlns:http="http://www.w3.org/2007/ont/http#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:sub="http://xmlns.computas.com/sublima#">
<rdfs:Class rdf:about="http://xmlns.computas.com/sublima#Resource">
<owl:unionOf rdf:resource="http://rdfs.org/sioc/ns#Site"/>
<owl:unionOf rdf:resource="http://rdfs.org/sioc/ns#Item"/>
<rdfs:subClassOf
rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
</rdfs:Class>
<sub:Resource rdf:about="http://www.kanalen.org/vitidiga/">
<sub:url rdf:resource="http://www.kanalen.org/vitidiga/"/>
<dct:title xml:lang="no">Vi tidiga - född för tidigt </dct:title>
<wdr:describedBy>
<wdr:DR
rdf:about="http://sublima.computas.com/status/godkjent_av_administrator">
<rdfs:label xml:lang="no">godkjent av administrator</rdfs:label>
<rdfs:label xml:lang="en">approved by administrator</rdfs:label>
</wdr:DR>
</wdr:describedBy>
<sub:committer>
<sioc:User
rdf:about="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/user/det_usr00022">
<rdfs:label xml:lang="no">Helena Hallgren</rdfs:label>
</sioc:User>
</sub:committer>
<dct:language>
<lingvoj:Lingvo rdf:about="http://www.lingvoj.org/lang/sv">
<lingvoj:iso3>swe</lingvoj:iso3>
<rdfs:label xml:lang="se">Ruoŧagiella</rdfs:label>
<rdfs:label xml:lang="en">Swedish</rdfs:label>
<lingvoj:iso2t>swe</lingvoj:iso2t>
<owl:sameAs
rdf:resource="http://sw.cyc.com/2006/07/27/cyc/SwedishLanguage"/>
<owl:sameAs
rdf:resource="http://dbpedia.org/resource/Swedish_language"/>
<rdfs:label xml:lang="sv">Svenska</rdfs:label>
<rdfs:label xml:lang="no">Svensk</rdfs:label>
<rdfs:label xml:lang="nn">Svensk</rdfs:label>
<rdfs:label xml:lang="da">Svensk</rdfs:label>
<owl:sameAs rdf:resource="http://psi.oasis-open.org/iso/639/#swe"/>
<rdfs:label xml:lang="fi">Ruotsin kieli</rdfs:label>
<lingvoj:iso1>sv</lingvoj:iso1>
<foaf:depiction
rdf:resource="http://upload.wikimedia.org/wikipedia/commons/4/4c/Flag_of_Sweden.svg"/>
</lingvoj:Lingvo>
</dct:language>
<dct:identifier
rdf:resource="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/resource/vi_tidiga__foedd_foer_tidigt_004314"/>
<dct:subject>
<skos:Concept
rdf:about="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000325">
<wdr:describedBy
rdf:resource="http://sublima.computas.com/status/godkjent_av_administrator"/>
<skos:altLabel xml:lang="da">Præmature børn </skos:altLabel>
<skos:altLabel xml:lang="sv">Prematura barn </skos:altLabel>
<sub:classification rdf:parseType="Literal">D007234</sub:classification>
<skos:prefLabel xml:lang="sv">För tidligt födda barn </skos:prefLabel>
<skos:note xml:lang="no">Premature barn </skos:note>
<skos:broader
rdf:resource="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000273"/>
<sub:isSubjectOf
rdf:resource="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/resource/prematur_foedsel_og_premature_barn_001005"/>
<skos:related
rdf:resource="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/Concept_50"/>
<skos:altLabel xml:lang="no">Premature barn </skos:altLabel>
<skos:prefLabel xml:lang="da">For tidligt fødte børn </skos:prefLabel>
<skos:prefLabel xml:lang="no">For tidlig fødte barn </skos:prefLabel>
<sub:isSubjectOf
rdf:resource="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/resource/foer_tidigt_vaerkarbete_007125"/>
<sub:committer
rdf:resource="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/user/det_usr00015"/>
<skos:inScheme
rdf:resource="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/"/>
</skos:Concept>
</dct:subject>
<dct:description xml:lang="no">Vi tidiga är en mötesplats för föräldrar
till för tidigt födda barn. Syftet med sidorna är att hjälpa nordiska föräldrar
till för tidigt födda barn att hitta information - och ge en möjlighet att
stötta varandra. </dct:description>
<dct:dateAccepted rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"
>2004-09-13T14:32:37</dct:dateAccepted>
<dct:publisher>
<foaf:Agent
rdf:about="http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/agent/Frldrakanalen">
<foaf:name xml:lang="no">Föräldrakanalen </foaf:name>
<dct:description xml:lang="no">Föräldrakanalen tillhör kanalen.org och
det är en familjesajt med faktasidor, diskussionsforum och chat.
</dct:description>
<dct:description xml:lang="no">Föräldrakanalen är en del av kanalen.org
och är en föräldrasajt för föräldrar av föräldrar som startade 1997.
</dct:description>
<dct:description xml:lang="no">Vi Tidiga är en fristående sidokanal
till "Föräldrakanalen". Vi Tidiga är skapad av ideella krafter utan
kommersiellt intresse, av vanliga föräldrar. Föräldrakanalen är en föräldrasajt
med faktasidor, diskussionsforum och chat. </dct:description>
</foaf:Agent>
</dct:publisher>
</sub:Resource>
</rdf:RDF>
package com.computas.mediasone.backend;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QueryException;
import virtuoso.jena.driver.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
import javax.servlet.ServletConfig;
import java.io.PrintWriter;
import java.io.IOException;
// import org.apache.log4j.Logger;
/**
* Servlet to create a simple Jena-based endpoint to serialize RDF/XML-ABBREV.
* User: kkj
* Date: Nov 13, 2008
* Time: 9:48:49 AM
*/
public class VirtJenaEndpoint extends HttpServlet {
static final long serialVersionUID = 1;
private String dbURL = "jdbc:virtuoso://tigger.computas.int:1111";
private String dbName="dba";
private String dbPassword="dba";
/* public void init(ServletConfig config) throws ServletException {
super.init(config);
ServletContext context = getServletContext();
dbURL = context.getInitParameter("database.url");
dbName = context.getInitParameter("database.username");
dbPassword = context.getInitParameter("database.password");
}
*/
// static Logger logger = Logger.getLogger(VirtJenaEndpoint.class);
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
VirtGraph vGraph = new VirtGraph(dbURL, dbName, dbPassword);
Query sparql;
try {
sparql = QueryFactory.create(req.getParameterValues("query")[0]);
} catch (QueryException e) {
res.sendError(400, "The SPARQL query was malformed: " + e.getMessage());
e.printStackTrace();
return;
}
VirtuosoQueryExecution exec = VirtuosoQueryExecutionFactory.create(sparql, vGraph);
Model model = exec.execDescribe();
/* Model test = ModelFactory.createDefaultModel();
Property p = test.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
NodeIterator nodes = model.listObjectsOfProperty(p);
while (nodes.hasNext()) {
logger.trace(nodes.nextNode().toString());
} */
res.setContentType("application/rdf+xml;charset=utf-8");
PrintWriter out = res.getWriter();
model.write(out, "RDF/XML-ABBREV");
out.close();
}
}