[
https://issues.apache.org/jira/browse/MARMOTTA-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13835255#comment-13835255
]
Alan commented on MARMOTTA-393:
-------------------------------
Hi Sergio,
I'm loading an RDF XML document via Sesame's RepositoryConnection.add(URL url,
String baseURI, RDFFormat dataFormat, Resource... contexts) method.
An example RDF XML doc is located at
http://vocabulary.curriculum.edu.au/access/export/access.rdf
There are two statements with the skos:topConceptOf predicate, one with a URI
object value and another with an literal object value.
{noformat}
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:cycAnnot="http://sw.cyc.com/CycAnnotations_v1#"
xmlns:cyc="http://sw.cyc.com/concept/"
xmlns:dbpedia="http://dbpedia.org/resource/"
xmlns:ctag="http://commontag.org/ns#"
xmlns:opencyc="http://sw.opencyc.org/concept/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:csw="http://semantic-web.at/ontologies/csw.owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:freebase="http://rdf.freebase.com/ns/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:tags="http://www.holygoat.co.uk/owl/redwood/0.1/tags/">
<rdf:Description rdf:about="http://vocabulary.curriculum.edu.au/access/10">
<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>
<skos:prefLabel xml:lang="en">Visual independence</skos:prefLabel>
<skos:topConceptOf
rdf:resource="http://vocabulary.curriculum.edu.au/access"/>
<skos:topConceptOf>http://vocabulary.curriculum.edu.au/access</skos:topConceptOf>
<dcterms:issued
rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2008-01-31T00:00:00</dcterms:issued>
<dcterms:modified
rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2010-11-15T00:00:00</dcterms:modified>
<skos:inScheme
rdf:resource="http://vocabulary.curriculum.edu.au/access"/>
<skos:scopeNote xml:lang="en">Content supports this profile if it has
been specifically designed to facilitate the learning experience for visually
impaired users. Content supporting this profile is not, however, guaranteed to
be suitable for all visually impaired learners. Vision impairment includes
tunnel vision, loss of vision in different parts of a person's visual field,
colour blindness, poor acuity, loss of centralised vision and severe vision
impairment.</skos:scopeNote>
<skos:narrower
rdf:resource="http://vocabulary.curriculum.edu.au/access/11"/>
</rdf:Description>
</rdf:RDF>
{noformat}
NB: is this a poor example as the data is bad, but it does highlight the issue.
> ClassCastException when loading Literal thats stored as a URI
> -------------------------------------------------------------
>
> Key: MARMOTTA-393
> URL: https://issues.apache.org/jira/browse/MARMOTTA-393
> Project: Marmotta
> Issue Type: Bug
> Components: KiWi Triple Store
> Affects Versions: 3.1-incubating
> Reporter: Alan
> Assignee: Sebastian Schaffert
> Priority: Minor
>
> When loading a literal value that already exists as a URI the
> KiWiConnection.loadLiteral throws an ClassCastException as the returned node
> is a URI.
> {noformat}
> Caused by: java.lang.ClassCastException:
> org.apache.marmotta.kiwi.model.rdf.KiWiUriResource cannot be cast to
> org.apache.marmotta.kiwi.model.rdf.KiWiLiteral
> at
> org.apache.marmotta.kiwi.persistence.KiWiConnection.loadLiteral(KiWiConnection.java:627)
> at
> org.apache.marmotta.kiwi.sail.KiWiValueFactory.createLiteral(KiWiValueFactory.java:435)
> at
> org.apache.marmotta.kiwi.sail.KiWiValueFactory.createLiteral(KiWiValueFactory.java:350)
> at
> org.openrdf.rio.helpers.RDFParserHelper.createLiteral(RDFParserHelper.java:250)
> {noformat}
> Perhaps KiWiConnection.loadLiteral(String value, String lang, KiWiUriResource
> ltype) could validate the type and return null e.g.
> From this:
> {noformat}
> return (KiWiLiteral)constructNodeFromDatabase(result);
> {noformat}
> To this:
> {noformat}
> KiWiNode node = constructNodeFromDatabase(result);
> KiWiNode kiWiNode = constructNodeFromDatabase(result);
> if(kiWiNode.isLiteral()) {
> return (KiWiLiteral)kiWiNode;
> } else {
> return null;
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.1#6144)