You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2013/10/25 12:44:21 UTC

git commit: MARMOTTA-314: Changed UriList() from Node to URI in the ldpath parser

Updated Branches:
  refs/heads/develop b3e26f792 -> 3a9d46d7c


MARMOTTA-314: Changed UriList() from Node to URI in the ldpath parser


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/3a9d46d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/3a9d46d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/3a9d46d7

Branch: refs/heads/develop
Commit: 3a9d46d7c36f618403f3b465319b1bb13e33386e
Parents: b3e26f7
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Oct 25 12:39:42 2013 +0200
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Oct 25 12:39:42 2013 +0200

----------------------------------------------------------------------
 .../marmotta/ldpath/model/programs/Program.java | 27 ++++++++++----------
 .../at/newmedialab/ldpath/parser/rdfpath.jj     | 10 ++++----
 2 files changed, 18 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/3a9d46d7/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/programs/Program.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/programs/Program.java b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/programs/Program.java
index ae4ffcb..6e6996a 100644
--- a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/programs/Program.java
+++ b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/programs/Program.java
@@ -18,6 +18,7 @@
 package org.apache.marmotta.ldpath.model.programs;
 
 
+import java.net.URI;
 import java.util.*;
 import java.util.Map.Entry;
 import java.util.regex.Matcher;
@@ -62,7 +63,7 @@ public class Program<Node> implements LDPathConstruct<Node> {
     /**
      * Restrict evaluation of the program to the graphs/contexts
      */
-    private Set<Node> graphs;
+    private Set<URI> graphs;
 
     /**
      * An (optional) filter to use for checking which resources should be
@@ -83,7 +84,7 @@ public class Program<Node> implements LDPathConstruct<Node> {
     public Program() {
         namespaces = new LinkedHashMap<String, String>();
         fields = new LinkedHashSet<FieldMapping<?,Node>>();
-        graphs = new LinkedHashSet<Node>();
+        graphs = new LinkedHashSet<URI>();
     }
 
     public void addNamespace(String prefix, String uri) {
@@ -135,7 +136,7 @@ public class Program<Node> implements LDPathConstruct<Node> {
         this.namespaces = new LinkedHashMap<String, String>(namespaces);
     }
 
-    public Set<Node> getGraphs() {
+    public Set<URI> getGraphs() {
         return this.graphs;
     }
 
@@ -144,7 +145,7 @@ public class Program<Node> implements LDPathConstruct<Node> {
         return (Node[]) this.graphs.toArray();
     }
 
-    public void setGraphs(Collection<Node> graphs) {
+    public void setGraphs(Collection<URI> graphs) {
         this.graphs.clear();
         this.graphs.addAll(graphs);
     }
@@ -186,17 +187,15 @@ public class Program<Node> implements LDPathConstruct<Node> {
         if (graphs != null && graphs.size() > 0) {
             sb.append("@graph");
             boolean first = true;
-            for (Node gaph : graphs) {
-                if (backend.isURI(gaph)) {
-                    if (first) {
-                        sb.append(" <");
-                    } else{
-                        sb.append(", <");
-                    }
-                    sb.append(backend.stringValue(gaph)).append(">");
-
-                    first = false;
+            for (URI graph : graphs) {
+                if (first) {
+                    sb.append(" <");
+                } else{
+                    sb.append(", <");
                 }
+                sb.append(graph.toString()).append(">");
+
+                first = false;
             }
             sb.append(" ;\n");
         }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/3a9d46d7/libraries/ldpath/ldpath-core/src/main/javacc/at/newmedialab/ldpath/parser/rdfpath.jj
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-core/src/main/javacc/at/newmedialab/ldpath/parser/rdfpath.jj b/libraries/ldpath/ldpath-core/src/main/javacc/at/newmedialab/ldpath/parser/rdfpath.jj
index bd71bb5..972a546 100644
--- a/libraries/ldpath/ldpath-core/src/main/javacc/at/newmedialab/ldpath/parser/rdfpath.jj
+++ b/libraries/ldpath/ldpath-core/src/main/javacc/at/newmedialab/ldpath/parser/rdfpath.jj
@@ -470,7 +470,7 @@ Program Program() :
     Map<String, String> nss = null;
     FieldMapping<?,Node> rule;
     NodeSelector<Node> boostSelector;
-    LinkedList<Node> graphs;
+    LinkedList<URI> graphs;
 }
 {
   (
@@ -514,16 +514,16 @@ Program Program() :
   }
 }
 
-LinkedList<Node> UriList() :
+LinkedList<URI> UriList() :
 {
-    LinkedList<Node> rest = null;
+    LinkedList<URI> rest = null;
     URI uri;
 }
 {
     uri = Uri() ( <COMMA> rest = UriList() )?
     {
-      if (rest == null) rest = new LinkedList<Node>();
-      rest.addFirst(resolveURI(uri));
+      if (rest == null) rest = new LinkedList<URI>();
+      rest.addFirst(uri);
       return rest;
     }
 }