--- /dev/null
+package org.simantics.graph.query;\r
+\r
+\r
+public class UriUtils {\r
+\r
+ public static Path uriToPath(String uri) {\r
+ String[] segments;\r
+ Path cur;\r
+ if(uri.startsWith("http:/")) {\r
+ if(uri.length() == 6)\r
+ return Paths.Root;\r
+ segments = uri.substring(7).split("/");\r
+ cur = Paths.Root;\r
+ }\r
+ else {\r
+ int p = uri.indexOf('/');\r
+ if(p == -1)\r
+ return new PathRoot(uri);\r
+ else {\r
+ segments = uri.substring(p+1).split("/");\r
+ cur = new PathRoot(uri.substring(0, p));\r
+ }\r
+ }\r
+\r
+ for(String segment : segments)\r
+ cur = new PathChild(segment, cur);\r
+ return cur;\r
+ }\r
+ \r
+}\r