Skip to content

Commit

Permalink
Fix describe/select *
Browse files Browse the repository at this point in the history
  • Loading branch information
langsamu committed Apr 10, 2021
1 parent a14cc9e commit 9dff0af
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sparql-blockly",
"version": "0.0.4-15",
"version": "0.0.4-16",
"description": "A library for working with SPARQL in Blockly",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion package/src/BlockGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ export default class BlockGenerator {
return items
}
private static isWildcard(variables: SparqlJS.Variable[] | SparqlJS.Term[] | [SparqlJS.Wildcard]): variables is [SparqlJS.Wildcard] {
return variables[0] instanceof SparqlJS.Wildcard
return "termType" in variables[0] && variables[0].termType == "Wildcard"
}
private static toTriplesSameSubject(triples: SparqlJS.Triple[]): TriplesSameSubject {
const process = (subjects: TriplesSameSubject, triple: SparqlJS.Triple) => {
Expand Down
43 changes: 43 additions & 0 deletions package/test/BlockGeneratorTests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -508,5 +508,48 @@ WHERE {
</block>
</xml>
</test>
<test name="Describe all">
<sparql>
<![CDATA[
DESCRIBE *
]]>
</sparql>
<xml>
<block type="sparql11_query">
<value name="value">
<block type="sparql11_describequery">
<field name="star">*</field>
</block>
</value>
</block>
</xml>
</test>
<test name="Select all">
<sparql>
<![CDATA[
SELECT * {}
]]>
</sparql>
<xml>
<block type="sparql11_query">
<value name="value">
<block type="sparql11_selectquery">
<value name="select">
<block type="sparql11_selectclause">
<field name="star">*</field>
</block>
</value>
<value name="where">
<block type="sparql11_querycommon">
<value name="pattern">
<block type="sparql11_groupgraphpattern"/>
</value>
</block>
</value>
</block>
</value>
</block>
</xml>
</test>
</tests>

0 comments on commit 9dff0af

Please sign in to comment.