Are typed literals "tricky" in RDF4J?
的后续行动我使用不同数据类型的文字对象,使自卸卡车的重量与三轮车重叠。我只对整数值感兴趣,所以我想根据数据类型进行过滤。一周前,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())
答案 0 :(得分:3)
将->
替换为=>
:
val intValuesFiltered = intValuesStream.filter(l => l.getDatatype().equals(XMLSchema.INTEGER))