sparql

package
v0.0.0-...-c339574 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)

This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)

Index

Constants

This section is empty.

Variables

View Source
var DifferentNodesOnGroupBy = []byte(`{
	"return": {
	  "entities": [
		2,
		3,
		11,
		12
	  ],
	  "relations": [
		1,
		10
	  ],
	  "groupBys": [
		6
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "commissions",
		"ID": 3,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 11,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 12,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  },
	  {
		"ID": 10,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 11,
		"toType": "entity",
		"toID": 12,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 6,
		"groupType": "entity",
		"groupID": [
		  3,
		  11
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  3,
		  12
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 1,
		"constraints": []
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var EmptyQueryResult = string(`SELECT DISTINCT ?e0 ?e1 ?r0 ?e2 ?r1
WHERE{
				FILTER(?r0 = <http://api.stardog.com/memberOf>)
				FILTER(?r1 = <http://api.stardog.com/memberOf>)
				FILTER regex(str(?e2), "e", "i")
				FILTER regex(str(?e0), "sierra", "i")
				?e0 ?r0 ?e1.
				?e2 ?r1 ?e1.
}`)
View Source
var EmptyQueryTripleMap = string(`{
    "Triples": {
        "r0": {
            "From": "e0",
            "To": "e1"
        },
        "r1": {
            "From": "e2",
            "To": "e1"
        }
    }
}`)
View Source
var IncorrectGroupByModifier = []byte(`{
	"return": {
	  "entities": [
		2,
		3
	  ],
	  "relations": [
		1
	  ],
	  "groupBys": [
		6
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "commissions",
		"ID": 3,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 6,
		"groupType": "entity",
		"groupID": [
		  2
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  3
		],
		"byAttribute": "_id",
		"appliedModifier": "wibblywobbly",
		"relationID": 1,
		"constraints": []
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var IncorrectRelationFrom = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": -4,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var NestingAndFilterTypes = []byte(`{
	"return": {
	  "entities": [
		0,
		1,
		2,
		3,
		4,
		5,
		6,
		7,
		8,
		9,
		10,
		11,
		12,
		13,
		14
	  ],
	  "relations": [
		0,
		1,
		2,
		3,
		4,
		5,
		6,
		7,
		8,
		9,
		10,
		11,
		12,
		13
	  ],
	  "groupBys": [
		0,
		1,
		2,
		3,
		4,
		5
	  ]
	},
	"entities": [
	  {
		"name": "Band",
		"ID": 0,
		"constraints": [
		  {
			"attribute": "id",
			"value": "e",
			"dataType": "string",
			"matchType": "contains"
		  }
		]
	  },
	  {
		"name": "Song",
		"ID": 1,
		"constraints": []
	  },
	  {
		"name": "Length",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "Song",
		"ID": 3,
		"constraints": []
	  },
	  {
		"name": "Length",
		"ID": 4,
		"constraints": []
	  },
	  {
		"name": "Song",
		"ID": 5,
		"constraints": []
	  },
	  {
		"name": "Length",
		"ID": 6,
		"constraints": []
	  },
	  {
		"name": "Song",
		"ID": 7,
		"constraints": []
	  },
	  {
		"name": "Length",
		"ID": 8,
		"constraints": []
	  },
	  {
		"name": "Song",
		"ID": 9,
		"constraints": []
	  },
	  {
		"name": "Length",
		"ID": 10,
		"constraints": []
	  },
	  {
		"name": "Song",
		"ID": 11,
		"constraints": []
	  },
	  {
		"name": "Length",
		"ID": 12,
		"constraints": []
	  },
	  {
		"name": "Song",
		"ID": 13,
		"constraints": [
		  {
			"attribute": "id",
			"value": "er",
			"dataType": "string",
			"matchType": "contains"
		  }
		]
	  },
	  {
		"name": "Person",
		"ID": 14,
		"constraints": [
		  {
			"attribute": "id",
			"value": "May",
			"dataType": "string",
			"matchType": "contains"
		  }
		]
	  }
	],
	"relations": [
	  {
		"ID": 0,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 0,
		"toType": "entity",
		"toID": 1,
		"constraints": []
	  },
	  {
		"ID": 1,
		"name": "hasLength",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 1,
		"toType": "entity",
		"toID": 2,
		"constraints": []
	  },
	  {
		"ID": 2,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 0,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  },
	  {
		"ID": 3,
		"name": "hasLength",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 3,
		"toType": "entity",
		"toID": 4,
		"constraints": []
	  },
	  {
		"ID": 4,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 1,
		"toType": "entity",
		"toID": 5,
		"constraints": []
	  },
	  {
		"ID": 5,
		"name": "hasLength",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 5,
		"toType": "entity",
		"toID": 6,
		"constraints": []
	  },
	  {
		"ID": 6,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 2,
		"toType": "entity",
		"toID": 7,
		"constraints": []
	  },
	  {
		"ID": 7,
		"name": "hasLength",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 7,
		"toType": "entity",
		"toID": 8,
		"constraints": []
	  },
	  {
		"ID": 8,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 3,
		"toType": "entity",
		"toID": 9,
		"constraints": []
	  },
	  {
		"ID": 9,
		"name": "hasLength",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 9,
		"toType": "entity",
		"toID": 10,
		"constraints": []
	  },
	  {
		"ID": 10,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 4,
		"toType": "entity",
		"toID": 11,
		"constraints": []
	  },
	  {
		"ID": 11,
		"name": "hasLength",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 11,
		"toType": "entity",
		"toID": 12,
		"constraints": []
	  },
	  {
		"ID": 12,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 5,
		"toType": "entity",
		"toID": 13,
		"constraints": []
	  },
	  {
		"ID": 13,
		"name": "memberOf",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 14,
		"toType": "groupBy",
		"toID": 5,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 0,
		"groupType": "entity",
		"groupID": [
			2
		],
		"groupAttribute": "_id",
		"byType": "entity",
		"byID": [
			0
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 0,
		"constraints": [
			{
				"attribute": "_id",
				"value": "162",
				"dataType": "int",
				"matchType": "GET"
			}
		]
	  },
	  {
		"ID": 1,
		"groupType": "entity",
		"groupID": [
			4
		],
		"groupAttribute": "_id",
		"byType": "groupBy",
		"byID": [
			0
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 0,
		"constraints": [
			{
				"attribute": "_id",
				"value": "200",
				"dataType": "int",
				"matchType": "GT"
			}
		]
	  },
	  {
		"ID": 2,
		"groupType": "entity",
		"groupID": [
			6
		],
		"groupAttribute": "_id",
		"byType": "groupBy",
		"byID": [
			1
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 0,
		"constraints": [
			{
				"attribute": "_id",
				"value": "350",
				"dataType": "int",
				"matchType": "LET"
			}
		]
	  },
	  {
		"ID": 3,
		"groupType": "entity",
		"groupID": [
			8
		],
		"groupAttribute": "_id",
		"byType": "groupBy",
		"byID": [
			2
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 0,
		"constraints": [
			{
				"attribute": "_id",
				"value": "300",
				"dataType": "int",
				"matchType": "LT"
			}
		]
	  },
	  {
		"ID": 4,
		"groupType": "entity",
		"groupID": [
			10
		],
		"groupAttribute": "_id",
		"byType": "groupBy",
		"byID": [
			3
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 0,
		"constraints": [
			{
				"attribute": "_id",
				"value": "288",
				"dataType": "int",
				"matchType": "NEQ"
			}
		]
	  },
	  {
		"ID": 5,
		"groupType": "entity",
		"groupID": [
			12
		],
		"groupAttribute": "_id",
		"byType": "groupBy",
		"byID": [
			4
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 0,
		"constraints": [
			{
				"attribute": "_id",
				"value": "251.8",
				"dataType": "int",
				"matchType": "EQ"
			}
		]
	  }
	],
	"machineLearning": [],
	"limit": 5000,
	"prefix": "http://api.stardog.com/"
  }`)
View Source
var NestingAndFilterTypesResult = string(`SELECT DISTINCT ?g5 ?e13 ?r12 ?e14 ?r13
Where
{
        {
                SELECT DISTINCT ?g5 (avg(?e12) AS ?avg_e12)
                Where
                {
                        {
                                SELECT DISTINCT ?g4 (avg(?e10) AS ?avg_e10)
                                Where
                                {
                                        {
                                                SELECT DISTINCT ?g3 (avg(?e8) AS ?avg_e8)
                                                Where
                                                {
                                                        {
                                                                SELECT DISTINCT ?g2 (avg(?e6) AS ?avg_e6)
                                                                Where
                                                                {
                                                                        {
                                                                                SELECT DISTINCT ?g1 (avg(?e4) AS ?avg_e4)
                                                                                Where
                                                                                {
                                                                                        {
                                                                                                SELECT DISTINCT ?g0 (avg(?e2) AS ?avg_e2)
                                                                                                Where
                                                                                                {
                                                                                                        FILTER(?r0 = <http://api.stardog.com/sings>)
                                                                                                        FILTER(?r1 = <http://api.stardog.com/hasLength>)
                                                                                                        FILTER regex(str(?e0), "e", "i")
                                                                                                        ?e0 ?r0 ?e1.
                                                                                                        ?e1 ?r1 ?e2.
                                                                                                        BIND(?e0 AS ?g0)
                                                                                                } GROUP BY ?g0 HAVING (?avg_e2 >= 162)
                                                                                        }
                                                                                        FILTER(?r3 = <http://api.stardog.com/hasLength>)
                                                                                        FILTER(?r2 = <http://api.stardog.com/sings>)
                                                                                        ?e3 ?r3 ?e4.
                                                                                        ?g0 ?r2 ?e3.
                                                                                        BIND(?g0 AS ?g1)
                                                                                } GROUP BY ?g1 HAVING (?avg_e4 > 200)
                                                                        }
                                                                        FILTER(?r5 = <http://api.stardog.com/hasLength>)
                                                                        FILTER(?r4 = <http://api.stardog.com/sings>)
                                                                        ?e5 ?r5 ?e6.
                                                                        ?g1 ?r4 ?e5.
                                                                        BIND(?g1 AS ?g2)
                                                                } GROUP BY ?g2 HAVING (?avg_e6 <= 350)
                                                        }
                                                        FILTER(?r7 = <http://api.stardog.com/hasLength>)
                                                        FILTER(?r6 = <http://api.stardog.com/sings>)
                                                        ?e7 ?r7 ?e8.
                                                        ?g2 ?r6 ?e7.
                                                        BIND(?g2 AS ?g3)
                                                } GROUP BY ?g3 HAVING (?avg_e8 < 300)
                                        }
                                        FILTER(?r9 = <http://api.stardog.com/hasLength>)
                                        FILTER(?r8 = <http://api.stardog.com/sings>)
                                        ?e9 ?r9 ?e10.
                                        ?g3 ?r8 ?e9.
                                        BIND(?g3 AS ?g4)
                                } GROUP BY ?g4 HAVING (?avg_e10 != 288)
                        }
                        FILTER(?r11 = <http://api.stardog.com/hasLength>)
                        FILTER(?r10 = <http://api.stardog.com/sings>)
                        ?e11 ?r11 ?e12.
                        ?g4 ?r10 ?e11.
                        BIND(?g4 AS ?g5)
                } GROUP BY ?g5 HAVING (?avg_e12 = 251.8)
        }
        FILTER(?r12 = <http://api.stardog.com/sings>)
        FILTER(?r13 = <http://api.stardog.com/memberOf>)
        FILTER regex(str(?e13), "er", "i")
        FILTER regex(str(?e14), "May", "i")
        ?g5 ?r12 ?e13.
        ?e14 ?r13 ?g5.
}`)
View Source
var NestingAndFilterTypesTripleMap = string(`{
    "Triples": {
        "r0": {
            "From": "e0",
            "To": "e1"
        },
        "r1": {
            "From": "e1",
            "To": "e2"
        },
        "r10": {
            "From": "g4",
            "To": "e11"
        },
        "r11": {
            "From": "e11",
            "To": "e12"
        },
        "r12": {
            "From": "g5",
            "To": "e13"
        },
        "r13": {
            "From": "e14",
            "To": "g5"
        },
        "r2": {
            "From": "g0",
            "To": "e3"
        },
        "r3": {
            "From": "e3",
            "To": "e4"
        },
        "r4": {
            "From": "g1",
            "To": "e5"
        },
        "r5": {
            "From": "e5",
            "To": "e6"
        },
        "r6": {
            "From": "g2",
            "To": "e7"
        },
        "r7": {
            "From": "e7",
            "To": "e8"
        },
        "r8": {
            "From": "g3",
            "To": "e9"
        },
        "r9": {
            "From": "e9",
            "To": "e10"
        }
    }
}`)
View Source
var NoRelationsField = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		}
	],		
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var SeparatedChainDoubleRelationPerChain = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1,
			2,
			3,
			4,
			5
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 3,
			"constraints": []
		},
		{
			"name": "resolutions",
			"ID": 4,
			"constraints": []
		},
		{
			"name": "resolutions",
			"ID": 5,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		},
		{
			"ID": 1,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 2,
			"toType": "entity",
			"toID": 3,
			"constraints":[]
		},
		{
			"ID": 2,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 4,
			"constraints":[]
		},
		{
			"ID": 3,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 2,
			"toType": "entity",
			"toID": 5,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var SeparatedChainSingleRelationPerChain = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1,
			2,
			3
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 3,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		},
		{
			"ID": 1,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 2,
			"toType": "entity",
			"toID": 3,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var SeperatedChainWithGroupBys = []byte(`{
	"return": {
	  "entities": [
		2,
		3,
		14,
		28,
		37,
		38,
		47
	  ],
	  "relations": [
		1,
		13,
		26,
		36,
		46
	  ],
	  "groupBys": [
		12,
		35
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 3,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 14,
		"constraints": []
	  },
	  {
		"name": "commissions",
		"ID": 28,
		"constraints": [
		  {
			"attribute": "name",
			"value": "f",
			"dataType": "string",
			"matchType": "contains"
		  }
		]
	  },
	  {
		"name": "parliament",
		"ID": 37,
		"constraints": []
	  },
	  {
		"name": "resolutions",
		"ID": 38,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 47,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  },
	  {
		"ID": 13,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 14,
		"toType": "groupBy",
		"toID": 12,
		"constraints": []
	  },
	  {
		"ID": 26,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 14,
		"toType": "entity",
		"toID": 28,
		"constraints": []
	  },
	  {
		"ID": 36,
		"name": "submits",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 37,
		"toType": "entity",
		"toID": 38,
		"constraints": []
	  },
	  {
		"ID": 46,
		"name": "submits",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 47,
		"toType": "groupBy",
		"toID": 35,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 12,
		"groupType": "entity",
		"groupID": [
		  2
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  3
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 1,
		"constraints": [
		  {
			"attribute": "age",
			"value": "42",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  },
	  {
		"ID": 35,
		"groupType": "entity",
		"groupID": [
		  37
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  38
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 36,
		"constraints": [
		  {
			"attribute": "age",
			"value": "45",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var SingleGroupBy = []byte(`{
	"return": {
	  "entities": [
		0,
		1,
		2,
		3,
		4
	  ],
	  "relations": [
		0,
		1,
		2,
		3
	  ],
	  "groupBys": [
		0
	  ]
	},
	"entities": [
	  {
		"name": "Band",
		"ID": 0,
		"constraints": [
		  {
			"attribute": "id",
			"value": "e",
			"dataType": "string",
			"matchType": "contains"
		  }
		]
	  },
	  {
		"name": "Song",
		"ID": 1,
		"constraints": []
	  },
	  {
		"name": "Length",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "Song",
		"ID": 3,
		"constraints": [
		  {
			"attribute": "id",
			"value": "er",
			"dataType": "string",
			"matchType": "contains"
		  }
		]
	  },
	  {
		"name": "Person",
		"ID": 4,
		"constraints": [
		  {
			"attribute": "id",
			"value": "es",
			"dataType": "string",
			"matchType": "contains"
		  }
		]
	  }
	],
	"relations": [
	  {
		"ID": 0,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 0,
		"toType": "entity",
		"toID": 1,
		"constraints": []
	  },
	  {
		"ID": 1,
		"name": "hasLength",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 1,
		"toType": "entity",
		"toID": 2,
		"constraints": []
	  },
	  {
		"ID": 2,
		"name": "sings",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 0,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  },
	  {
		"ID": 3,
		"name": "memberOf",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 4,
		"toType": "groupBy",
		"toID": 0,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 0,
		"groupType": "entity",
		"groupID": [
			2
		],
		"groupAttribute": "_id",
		"byType": "entity",
		"byID": [
			0
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 0,
		"constraints": [
			{
				"attribute": "_id",
				"value": "300",
				"dataType": "int",
				"matchType": "GT"
			}
		]
	  }
	],
	"machineLearning": [],
	"limit": 5000,
	"prefix": "http://api.stardog.com/"
  }
`)
View Source
var SingleGroupByResult = string(`SELECT DISTINCT ?g0 ?e3 ?r2 ?e4 ?r3
Where
{
        {
                SELECT DISTINCT ?g0 (avg(?e2) AS ?avg_e2)
                Where
                {
                        FILTER(?r0 = <http://api.stardog.com/sings>)
                        FILTER(?r1 = <http://api.stardog.com/hasLength>)
                        FILTER regex(str(?e0), "e", "i")
                        ?e0 ?r0 ?e1.
                        ?e1 ?r1 ?e2.
                        BIND(?e0 AS ?g0)
                } GROUP BY ?g0 HAVING (?avg_e2 > 300)
        }
        FILTER(?r2 = <http://api.stardog.com/sings>)
        FILTER(?r3 = <http://api.stardog.com/memberOf>)
        FILTER regex(str(?e3), "er", "i")
        FILTER regex(str(?e4), "es", "i")
        ?g0 ?r2 ?e3.
        ?e4 ?r3 ?g0.
}`)
View Source
var SingleGroupByTripleMap = string(`{
    "Triples": {
        "r0": {
            "From": "e0",
            "To": "e1"
        },
        "r1": {
            "From": "e1",
            "To": "e2"
        },
        "r2": {
            "From": "g0",
            "To": "e3"
        },
        "r3": {
            "From": "e4",
            "To": "g0"
        }
    }
}`)

Functions

This section is empty.

Types

type Service

type Service struct {
}

Service implements the QueryConverter interface (in the query service)

func (*Service) ConvertQuery

func (s *Service) ConvertQuery(JSONQuery *entity.IncomingQueryJSON) (*string, *[]byte, error)

ConvertQuery converts an IncomingQueryJSON object into SPARQL

JSONQuery: *entity.IncomingQueryJSON, the query to be converted to SPARQL
Returns: *string, the SPARQL query and a possible error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL