[ 
https://issues.apache.org/jira/browse/MARMOTTA-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13846252#comment-13846252
 ] 

ASF subversion and git services commented on MARMOTTA-393:
----------------------------------------------------------

Commit c6478813295ff26d2f5259e3cacd3e36a0df9e52 in branch 
refs/heads/maintenance-3.1.x from [~wastl]
[ https://git-wip-us.apache.org/repos/asf?p=marmotta.git;h=c647881 ]

MARMOTTA-393: backport fix in SQL statement for loading literals
(cherry picked from commit 35513348fb521a436e5cf1cfa9bbc069d400ad08)

Signed-off-by: Jakob Frank <[email protected]>


> 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
>             Fix For: 3.1.1, 3.2
>
>
> 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.4#6159)

Reply via email to