0
一個後續Are typed literals "tricky" in RDF4J?轉換RDF4J流過濾器(拉姆達?)從Java到斯卡拉
我有一些三元緊靠自卸卡車的重量,使用文字對象的不同數據類型。我只對整數值感興趣,所以我想根據數據類型進行過濾。大約一週前,Jeen Broekstra發送了一個Java解決方案,但我很難將其轉換爲我團隊首選語言Scala。
這是我到目前爲止。 Eclipse是抱怨
未發現:值L
val rdf4jServer = "http://host.domain:7200"
val repositoryID = "trucks"
val MyRepo = new HTTPRepository(rdf4jServer, repositoryID)
MyRepo.initialize()
var con = MyRepo.getConnection()
val f = MyRepo.getValueFactory()
val DumpTruck = f.createIRI("http://example.com/dumpTruck")
val Weight = f.createIRI("http://example.com/weight")
val m = QueryResults.asModel(con.getStatements(DumpTruck, Weight, null))
val intValuesStream = Models.objectLiterals(m).stream()
# OK up to here
# errors start below
val intValuesFiltered =
intValuesStream.filter(l -> l.getDatatype().equals(XMLSchema.INTEGER))
val intValues = intValuesFiltered.collect(Collectors.toList())
您也可以儘量避免使用'=>'你的情況,即'過濾器(_。getDatatype()。等於(XMLSchema.INTEGER))' – AKSW