我想用JavaScript添加一个元素.
我有以下代码:
var collection = document.getElementsByTagName('body');
var a = document.createElement('div');
a.innerHTML = 'some text';
collection.item(0).firstChild.appendChild(a);
Run Code Online (Sandbox Code Playgroud)
和简单的HTML:
<html>
<head></head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
哪里出错?
我如何"说"SPARQL?churchname是UTF-8格式?因为回应如下:Pražskýhrad
PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
PREFIX abc: <http://dbpedia.org/class/yago/>
SELECT ?churchname
WHERE
{
<http://dbpedia.org/resource/Prague> geo:geometry ?gm .
?church a lgv:castle .
?church geo:geometry ?churchgeo .
?church lgv:name ?churchname .
FILTER ( bif:st_intersects (?churchgeo,?gm, 10))
}
GROUP BY ?churchname
ORDER BY ?churchname
如何以UTF-8格式获得Jena(Java语言)结果?我的代码:
Query query= QueryFactory.create(queryString);
QueryExecution qexec= QueryExecutionFactory.sparqlService("http://lod.openlinksw.com/sparql", queryString);
ResultSet results = qexec.execSelect();
List<QuerySolution> list = ResultSetFormatter.toList(results);
System.out.println(list.get(i).get("churchname"));
Run Code Online (Sandbox Code Playgroud)