String queryString2 = "PREFIX service: <http://www.usa.gov/services/> "
+ " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+ " PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
+ " PREFIX owl: <http://www.w3.org/2002/07/owl#> "
+ " SELECT ?entity ?categoryname ?servicename ?description WHERE { "
+ "{ "
+ " ?entity a owl:Class; rdfs:subClassOf %s; rdfs:label ?categoryname. "
+ " OPTIONAL {?entity rdfs:description ?description}. "
+ "} "
+ "UNION "
+ " { "
+ "?entity rdf:type %s; service:name ?servicename. "
+ " OPTIONAL {?entity service:description ?description}. "
+ " } " + "}";
Query query = QueryFactory.create(queryString2);
大家好,
使用 Jena API 运行上述查询时,出现以下错误。有人可以帮我解决这个问题。
com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 315. Encountered: "%" (37), after : ""