Skip to content

Commit 9dff0af

Browse files
committed
Fix describe/select *
1 parent a14cc9e commit 9dff0af

File tree

4 files changed

+47
-4
lines changed

4 files changed

+47
-4
lines changed

package/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sparql-blockly",
3-
"version": "0.0.4-15",
3+
"version": "0.0.4-16",
44
"description": "A library for working with SPARQL in Blockly",
55
"main": "dist/index.js",
66
"license": "MIT",

package/src/BlockGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ export default class BlockGenerator {
10471047
return items
10481048
}
10491049
private static isWildcard(variables: SparqlJS.Variable[] | SparqlJS.Term[] | [SparqlJS.Wildcard]): variables is [SparqlJS.Wildcard] {
1050-
return variables[0] instanceof SparqlJS.Wildcard
1050+
return "termType" in variables[0] && variables[0].termType == "Wildcard"
10511051
}
10521052
private static toTriplesSameSubject(triples: SparqlJS.Triple[]): TriplesSameSubject {
10531053
const process = (subjects: TriplesSameSubject, triple: SparqlJS.Triple) => {

package/test/BlockGeneratorTests.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,5 +508,48 @@ WHERE {
508508
</block>
509509
</xml>
510510
</test>
511+
<test name="Describe all">
512+
<sparql>
513+
<![CDATA[
514+
DESCRIBE *
515+
]]>
516+
</sparql>
517+
<xml>
518+
<block type="sparql11_query">
519+
<value name="value">
520+
<block type="sparql11_describequery">
521+
<field name="star">*</field>
522+
</block>
523+
</value>
524+
</block>
525+
</xml>
526+
</test>
527+
<test name="Select all">
528+
<sparql>
529+
<![CDATA[
530+
SELECT * {}
531+
]]>
532+
</sparql>
533+
<xml>
534+
<block type="sparql11_query">
535+
<value name="value">
536+
<block type="sparql11_selectquery">
537+
<value name="select">
538+
<block type="sparql11_selectclause">
539+
<field name="star">*</field>
540+
</block>
541+
</value>
542+
<value name="where">
543+
<block type="sparql11_querycommon">
544+
<value name="pattern">
545+
<block type="sparql11_groupgraphpattern"/>
546+
</value>
547+
</block>
548+
</value>
549+
</block>
550+
</value>
551+
</block>
552+
</xml>
553+
</test>
511554
</tests>
512555

0 commit comments

Comments
 (0)