jenkins-bot has submitted this change and it was merged.

Change subject: Improve completion, add more completion words
......................................................................


Improve completion, add more completion words

Bug: T144052
Change-Id: I95ef1f3531f2abe11a204696e457805907757725
---
M wikibase/queryService/RdfNamespaces.js
M wikibase/queryService/ui/editor/hint/Rdf.js
M wikibase/queryService/ui/editor/hint/Sparql.js
3 files changed, 51 insertions(+), 6 deletions(-)

Approvals:
  Smalyshev: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wikibase/queryService/RdfNamespaces.js 
b/wikibase/queryService/RdfNamespaces.js
index b10bdc1..29a5c39 100644
--- a/wikibase/queryService/RdfNamespaces.js
+++ b/wikibase/queryService/RdfNamespaces.js
@@ -16,10 +16,13 @@
                        wdv: 'http://www.wikidata.org/value/',
                        ps: 'http://www.wikidata.org/prop/statement/',
                        psv: 'http://www.wikidata.org/prop/statement/value/',
+                       psn: 
'http://www.wikidata.org/prop/statement/value-normalized/',
                        pq: 'http://www.wikidata.org/prop/qualifier/',
                        pqv: 'http://www.wikidata.org/prop/qualifier/value/',
+                       pqn: 
'http://www.wikidata.org/prop/qualifier/value-normalized/',
                        pr: 'http://www.wikidata.org/prop/reference/',
                        prv: 'http://www.wikidata.org/prop/reference/value/',
+                       prn: 
'http://www.wikidata.org/prop/reference/value-normalized/',
                        wdno: 'http://www.wikidata.org/prop/novalue/',
                        wdata: 
'http://www.wikidata.org/wiki/Special:EntityData/'
                },
@@ -48,10 +51,13 @@
                'http://www.wikidata.org/prop/novalue/': 'property',
                'http://www.wikidata.org/prop/statement/': 'property',
                'http://www.wikidata.org/prop/statement/value/': 'property',
+               'http://www.wikidata.org/prop/statement/value-normalized/': 
'property',
                'http://www.wikidata.org/prop/qualifier/': 'property',
                'http://www.wikidata.org/prop/qualifier/value/': 'property',
+               'http://www.wikidata.org/prop/qualifier/value-normalized/': 
'property',
                'http://www.wikidata.org/prop/reference/': 'property',
                'http://www.wikidata.org/prop/reference/value/': 'property',
+               'http://www.wikidata.org/prop/reference/value-normalized/': 
'property',
                'http://www.wikidata.org/wiki/Special:EntityData/': 'item',
                'http://www.wikidata.org/entity/': 'item'
        };
diff --git a/wikibase/queryService/ui/editor/hint/Rdf.js 
b/wikibase/queryService/ui/editor/hint/Rdf.js
index f3b9c08..aa604af 100755
--- a/wikibase/queryService/ui/editor/hint/Rdf.js
+++ b/wikibase/queryService/ui/editor/hint/Rdf.js
@@ -62,6 +62,10 @@
                entityPrefixes = this._extractPrefixes( editorContent );
 
                if ( !entityPrefixes[prefix] ) { // unknown prefix
+                       if ( this._rdfNamespaces.ALL_PREFIXES && 
this._rdfNamespaces.ALL_PREFIXES[prefix] ) {
+                               // Sparql.js may deal with those prefixes
+                               return deferred.reject().promise();
+                       }
                        list = [ {
                                text: term,
                                displayText: 'Unknown prefix \'' + prefix + 
':\''
diff --git a/wikibase/queryService/ui/editor/hint/Sparql.js 
b/wikibase/queryService/ui/editor/hint/Sparql.js
index 3724694..3e38292 100755
--- a/wikibase/queryService/ui/editor/hint/Sparql.js
+++ b/wikibase/queryService/ui/editor/hint/Sparql.js
@@ -22,15 +22,50 @@
        ];
 
        var SPARQL_PREDICATES = [
+                       // wikibase:
+                       // property predicates
                        'wikibase:rank', 'wikibase:badge', 
'wikibase:propertyType', 'wikibase:directClaim',
                        'wikibase:claim', 'wikibase:statementProperty', 
'wikibase:statementValue',
                        'wikibase:qualifier', 'wikibase:qualifierValue', 
'wikibase:referenceValue',
-                       'wikibase:Reference', 'wikibase:TimeValue', 
'wikibase:QuantityValue',
-                       'wikibase:GlobecoordinateValue', 'wikibase:Dump', 
'wikibase:PreferredRank',
-                       'wikibase:NormalRank', 'wikibase:DeprecatedRank', 
'wikibase:BestRank',
+                       'wikibase:statementValueNormalized', 
'wikibase:qualifierValueNormalized',
+                       'wikibase:referenceValueNormalized', 'wikibase:novalue',
+                       // data types
+                       'wikibase:Reference', 'wikibase:Dump',
+                       // ranks
+                       'wikibase:PreferredRank', 'wikibase:NormalRank', 
'wikibase:DeprecatedRank', 'wikibase:BestRank',
+                       // value types
+                       'wikibase:TimeValue', 'wikibase:QuantityValue', 
'wikibase:GlobecoordinateValue',
+                       // property types
                        'wikibase:WikibaseItem', 'wikibase:CommonsMedia', 
'wikibase:Globecoordinate',
                        'wikibase:Monolingualtext', 'wikibase:Quantity', 
'wikibase:String', 'wikibase:Time',
-                       'wikibase:Url', 'rdfs:about', 'schema:name', 
'schema:description', 'rdfs:label'
+                       'wikibase:Url', 'wikibase:ExternalId',
+                       // pageprops
+                       'wikibase:statements', 'wikibase:sitelinks',
+                       // time
+                       'wikibase:timeValue', 'wikibase:timePrecision', 
'wikibase:timeTimezone', 'wikibase:timeCalendarModel',
+                       // quantity
+                       'wikibase:quantityAmount', 
'wikibase:quantityUpperBound', 'wikibase:quantityLowerBound',
+                       'wikibase:quantityUnit', 'wikibase:quantityNormalized',
+                       // coordinate
+                       'wikibase:geoLatitude', 'wikibase:geoLongitude', 
'wikibase:geoPrecision', 'wikibase:geoGlobe',
+                       // other
+                       'wikibase:wikiGroup',
+                       // schema: things
+                       'schema:about', 'schema:name', 'schema:description', 
'schema:dateModified',
+                       'schema:Article', 'schema:inLanguage', 
'schema:isPartOf',
+                       // rdfs: things
+                       'rdfs:label', 'rdf:type',
+                       // skos: things
+                       'skos:altLabel',
+                       // xsd:
+                       'xsd:dateTime', 'xsd:integer', 'xsd:decimal',
+                       // geo:
+                       'geo:wktLiteral',
+                       // owl:
+                       'owl:sameAs',
+                       // prov:
+                       'prov:wasDerivedFrom'
+
        ];
 
        /**
@@ -135,7 +170,7 @@
                        pos = 0;
                }
 
-               while ( /[\w?#]/.test( line.charAt( pos ) ) ) {
+               while ( /[\w?#:]/.test( line.charAt( pos ) ) ) {
                        pos--;
                        if ( pos < 0 ) {
                                break;
@@ -144,7 +179,7 @@
                var left = pos + 1;
 
                pos = position;
-               while ( /\w/.test( line.charAt( pos ) ) ) {
+               while ( /[\w:]/.test( line.charAt( pos ) ) ) {
                        pos++;
                        if ( pos >= line.length ) {
                                break;

-- 
To view, visit https://gerrit.wikimedia.org/r/312151
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I95ef1f3531f2abe11a204696e457805907757725
Gerrit-PatchSet: 5
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de>
Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: Thiemo M├Ąttig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to