0

A follow-up to Are typed literals "tricky" in RDF4J?

I have some triples abut the weight of dump trucks, using literal objects with different data types. I'm only interested in the integer values, so I want to filter based on the data type. Jeen Broekstra sent a Java solution about a week ago, and I'm having trouble converting it into Scala, my team's preferred language.

This is what I have so far. Eclipse is complaining

not found: value 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())
TallTed
  • 9,069
  • 2
  • 22
  • 37
Mark Miller
  • 3,011
  • 1
  • 14
  • 34

1 Answers1

3

Replace the -> with =>:

val intValuesFiltered = intValuesStream.filter(l => l.getDatatype().equals(XMLSchema.INTEGER))
Jeffrey Chung
  • 19,319
  • 8
  • 34
  • 54