Commit 2427dc8b authored by Vishesh Handa's avatar Vishesh Handa
Browse files

Backup Statement Generator: statements without a datatype can be valid

In Nepomuk the nao:description is stored as an rdfs literal, which means
it doesn't have a datatype, but is supposed to have a language tag.
Since we don't store the language tag, it is just stored as a string.
This used to be considered invalid by the statement generator and
therefore the nao:description (dolphin comments) was never backed up
even though it was requested.

Also added unit test

BUG: 323260
REVIEW: 111947
parent 4147b862
......@@ -274,6 +274,7 @@ void BackupTests::tagsAndRatings()
fileRes1.addType( NFO::FileDataObject() );
fileRes1.setProperty( NIE::url(), fileUrl1 );
fileRes1.setProperty( NAO::numericRating(), 5 );
fileRes1.setProperty( NAO::description(), QLatin1String("Booga") );
SimpleResource tagRes;
tagRes.addType( NAO::Tag() );
......@@ -331,6 +332,13 @@ void BackupTests::tagsAndRatings()
.arg( Soprano::Node::resourceToN3(resUri) );
QVERIFY( model->executeQuery( query, Soprano::Query::QueryLanguageSparql ).boolValue() );
// Make sure the fileRes has its description
query = QString::fromLatin1("select ?d where { %1 nao:description ?d . }")
.arg( Soprano::Node::resourceToN3( resUri ) );
it = model->executeQuery( query, Soprano::Query::QueryLanguageSparql );
QVERIFY( it.next() );
QCOMPARE( it[0].literal().toString(), QLatin1String("Booga") );
}
......
......@@ -172,8 +172,12 @@ namespace {
if( object.isLiteral() ) {
Soprano::LiteralValue lv = object.literal();
if( lv.dataTypeUri().isEmpty() )
if( lv.dataTypeUri().isEmpty() ) {
// Plain nodes in Nepomuk don't have a language tag
if( lv.isPlain() && !lv.toString().isEmpty() )
return true;
return false;
}
if( lv.isString() && lv.toString().isEmpty() )
return false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment