void System::initCompletions() { addCompletion("args"); addCompletion("env"); addCompletion("platform"); addCompletion("os"); }
void System::initCompletions() { addCompletion("args"); addCompletion("env"); addCompletion("platform"); addCompletion("os"); addCompletion("isSSLSupported"); }
void Nepomuk::ResourceCompletion::makeCompletion( const QString& string ) { kDebug() << string; if ( string.length() > 3 ) { Query::AndTerm term; term.addSubTerm( Query::LiteralTerm( string + '*' ) ); if ( d->type.isValid() && d->type != Soprano::Vocabulary::RDFS::Resource() ) term.addSubTerm( Query::ResourceTypeTerm( d->type ) ); Query::Query query(term); query.setLimit( 10 ); kDebug() << query.toSparqlQuery(); Soprano::QueryResultIterator it = ResourceManager::instance()->mainModel()->executeQuery( query.toSparqlQuery(), Soprano::Query::QueryLanguageSparql ); while ( it.next() ) { Resource res( it.binding( 0 ).uri() ); double score = 1.0; //it[1].literal().toDouble(); kDebug() << "Match for input" << string << res.uri(); addCompletion( KCompletionItem( res.genericLabel(), QString( "%1 (%2)" ).arg( res.genericLabel() ).arg( Types::Class( res.type() ).label() ), res.genericDescription(), KIcon( res.genericIcon() ), score, res.resourceUri() ) ); } } }
void Phantom::initCompletions() { // Add completion for the Dynamic Properties of the 'phantom' object // properties addCompletion("args"); addCompletion("defaultPageSettings"); addCompletion("libraryPath"); addCompletion("outputEncoding"); addCompletion("scriptName"); addCompletion("version"); // functions addCompletion("exit"); addCompletion("injectJs"); }
void Nepomuk::TypeCompletion::makeCompletion( const QString& string ) { // FIXME: if the string contains a : treat everything before it as a qname and match it to a namespace (for example by comparing the last section) kDebug() << string; if ( string.length() > 2 ) { Query::Query query( Query::AndTerm( Query::ResourceTypeTerm( Soprano::Vocabulary::RDFS::Class() ), Query::ComparisonTerm( Types::Property(), Query::LiteralTerm( string + '*' ) ) ) ); Soprano::QueryResultIterator it = ResourceManager::instance()->mainModel()->executeQuery( query.toSparqlQuery(), Soprano::Query::QueryLanguageSparql ); int cnt = 0; while ( it.next() ) { Types::Class type( it[0].uri() ); double score = 1.0;// it[1].literal().toDouble(); kDebug() << "possible match:" << type.label() << type.uri() << score; if ( ( !d->baseType.isValid() || type.isSubClassOf( d->baseType ) ) && score > 0.5 ) { kDebug() << "match:" << type.label() << type.uri(); addCompletion( KCompletionItem( type.label(), type.label(), type.comment() + '\n' + '(' + type.uri().toString() + ')', type.icon(), score, type.uri() ) ); if ( ++cnt >= 10 ) { kDebug() << "Stopping at" << cnt << "results"; return; } } } } }