[17] | 1 | package hozo.sparql;
|
---|
[9] | 2 |
|
---|
| 3 | import java.util.LinkedHashMap;
|
---|
| 4 | import java.util.List;
|
---|
| 5 | import java.util.Map;
|
---|
| 6 |
|
---|
| 7 | import com.hp.hpl.jena.rdf.model.RDFNode;
|
---|
| 8 |
|
---|
| 9 | public class SparqlResultSet {
|
---|
| 10 |
|
---|
| 11 | private final String DEFAULT_KEY = "_";
|
---|
| 12 |
|
---|
| 13 | private Map<String, List<Map<String, RDFNode>>> result;
|
---|
| 14 | private boolean hasNext;
|
---|
| 15 |
|
---|
| 16 | public SparqlResultSet(List<Map<String, RDFNode>> result){
|
---|
| 17 | this(result, false);
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public SparqlResultSet(List<Map<String, RDFNode>> result, boolean hasNext){
|
---|
| 21 | this.result = new LinkedHashMap<String, List<Map<String, RDFNode>>>();
|
---|
| 22 | this.result.put(DEFAULT_KEY, result);
|
---|
| 23 | this.hasNext = hasNext;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | /**
|
---|
| 27 | * @return result
|
---|
| 28 | */
|
---|
| 29 | public List<Map<String, RDFNode>> getDefaultResult() {
|
---|
| 30 | return getResult(DEFAULT_KEY);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | public List<Map<String, RDFNode>> getResult(String endpoint) {
|
---|
| 34 | return result.get(endpoint);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public Map<String, List<Map<String, RDFNode>>> getResult(){
|
---|
| 38 | return result;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | /**
|
---|
| 43 | * @param result 繧サ繝�ヨ縺吶k result
|
---|
| 44 | */
|
---|
| 45 | public void setDefaultResult(List<Map<String, RDFNode>> result) {
|
---|
| 46 | this.addResult(DEFAULT_KEY, result);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | public void addResult(String endpoint, List<Map<String, RDFNode>> result) {
|
---|
| 50 | this.result.put(endpoint, result);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 |
|
---|
| 54 | /**
|
---|
| 55 | * @return hasNext
|
---|
| 56 | */
|
---|
| 57 | public boolean isHasNext() {
|
---|
| 58 | return hasNext;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | * @param hasNext 繧サ繝�ヨ縺吶k hasNext
|
---|
| 63 | */
|
---|
| 64 | public void setHasNext(boolean hasNext) {
|
---|
| 65 | this.hasNext = hasNext;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | }
|
---|