我想在scala中構建一個sparql查詢。我有使用apache arq庫的問題,這是Java的意思。依賴關係似乎沒有問題,但是Intellij無法解析ParameterizedSparqlString構造函數並生成QueryEngineHTTP構造函數。我正在運行jdk 1.8。有任何想法嗎?感謝!Scala Sparql與Apache Jena的查詢
val sparqlentities = namedEntitiesByDocument
.mapPartitions(iter => {
val sparqlEndpoint = "localhost:1643";
iter.map(t => {
t._1, t._2.map(namedEntity => {
val sparqlQuery = "" + "SELECT ?s { \n ?s rdfs:label" + namedEntity.surfaceForm + " . \n }"
val query = QueryFactory.create(sparqlQuery, Syntax.syntaxARQ)
// val querySolutionMap = new QuerySolutionMap()
val parameterizedSparqlString = new ParameterizedSparqlString(query.toString(), new QuerySolutionMap())
val httpQuery = new QueryEngineHTTP(sparqlEndpoint,parameterizedSparqlString.asQuery())
val results = httpQuery.execSelect()
while (results.hasNext()) {
val solution = results.next()
val fin_result = solution.get("s").asLiteral().getLexicalForm()
(namedEntity.surfaceForm, fin_result)
}
})
})
})
哪個耶拿版?你使用Maven嗎?如果是這樣,請顯示Maven依賴項。最後,你真的得到一個編譯器錯誤嗎? – AKSW