public static Path parse(String str, PrefixMapping pmap) { return parse(str, new Prologue(pmap)) ; }
public static Dataset getConversationAndNeedsDataset(URI connectionURI, LinkedDataSource linkedDataSource) { assert linkedDataSource != null : "linkedDataSource must not be null"; int depth = 5; int maxRequests = 1000; List<Path> propertyPaths = new ArrayList<>(); PrefixMapping pmap = new PrefixMappingImpl(); pmap.withDefaultMappings(PrefixMapping.Standard); pmap.setNsPrefix("won", WON.getURI()); pmap.setNsPrefix("msg", WONMSG.getURI()); propertyPaths.add(PathParser.parse("won:hasEventContainer", pmap)); propertyPaths.add(PathParser.parse("won:hasEventContainer/rdfs:member", pmap)); propertyPaths.add(PathParser.parse("won:hasEventContainer/rdfs:member/msg:hasCorrespondingRemoteMessage", pmap)); propertyPaths.add(PathParser.parse("won:hasEventContainer/rdfs:member/msg:hasPreviousMessage", pmap)); propertyPaths.add(PathParser.parse("won:belongsToNeed", pmap)); propertyPaths.add(PathParser.parse("won:belongsToNeed/won:hasEventContainer", pmap)); propertyPaths.add(PathParser.parse("won:belongsToNeed/won:hasEventContainer/rdfs:member", pmap)); propertyPaths.add(PathParser.parse("won:belongsToNeed/won:hasEventContainer/rdfs:member/msg:hasPreviousMessage", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteNeed", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteNeed/won:hasEventContainer", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteNeed/won:hasEventContainer/rdfs:member", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteNeed/won:hasEventContainer/rdfs:member/msg:hasPreviousMessage", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteConnection", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteConnection/won:hasEventContainer", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteConnection/won:hasEventContainer/rdfs:member", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteConnection/won:hasEventContainer/rdfs:member/msg:hasCorrespondingRemoteMessage", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteConnection/won:hasEventContainer/rdfs:member/msg:hasPreviousMessage", pmap)); URI requesterWebId = WonLinkedDataUtils.getNeedURIforConnectionURI(connectionURI, linkedDataSource); return linkedDataSource.getDataForResourceWithPropertyPath(connectionURI, requesterWebId, propertyPaths, maxRequests, depth); }
public static Dataset getConversationDataset(URI connectionURI, LinkedDataSource linkedDataSource) { assert linkedDataSource != null : "linkedDataSource must not be null"; int depth = 5; // depth 3 from connection gives us the messages in the conversation int maxRequests = 1000; List<Path> propertyPaths = new ArrayList<>(); PrefixMapping pmap = new PrefixMappingImpl(); pmap.withDefaultMappings(PrefixMapping.Standard); pmap.setNsPrefix("won", WON.getURI()); pmap.setNsPrefix("msg", WONMSG.getURI()); propertyPaths.add(PathParser.parse("won:hasEventContainer", pmap)); propertyPaths.add(PathParser.parse("won:hasEventContainer/rdfs:member", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteConnection", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteConnection/won:hasEventContainer", pmap)); propertyPaths.add(PathParser.parse("won:hasRemoteConnection/won:hasEventContainer/rdfs:member", pmap)); URI requesterWebId = WonLinkedDataUtils.getNeedURIforConnectionURI(connectionURI, linkedDataSource); return linkedDataSource.getDataForResourceWithPropertyPath(connectionURI, requesterWebId, propertyPaths, maxRequests, depth); }
public static URI getEventContainerURIforConnectionURI(URI connectionURI, LinkedDataSource linkedDataSource) { assert linkedDataSource != null : "linkedDataSource must not be null"; Dataset dataset = getDatalForResource(connectionURI, linkedDataSource); Path propertyPath = PathParser.parse("<" + WON.HAS_EVENT_CONTAINER+ ">", PrefixMapping.Standard); return RdfUtils.getURIPropertyForPropertyPath(dataset, connectionURI, propertyPath); }
public static URI getRemoteConnectionURIforConnectionURI(URI connectionURI, LinkedDataSource linkedDataSource) { assert linkedDataSource != null : "linkedDataSource must not be null"; Dataset dataset = getDatalForResource(connectionURI, linkedDataSource); Path propertyPath = PathParser.parse("<" + WON.HAS_REMOTE_CONNECTION + ">", PrefixMapping.Standard); return RdfUtils.getURIPropertyForPropertyPath(dataset, connectionURI, propertyPath); }
public static URI getEventContainerURIforNeedURI(URI needURI, LinkedDataSource linkedDataSource) { assert linkedDataSource != null : "linkedDataSource must not be null"; Dataset dataset = getDatalForResource(needURI, linkedDataSource); Path propertyPath = PathParser.parse("<" + WON.HAS_EVENT_CONTAINER+ ">", PrefixMapping.Standard); return RdfUtils.getURIPropertyForPropertyPath(dataset, needURI, propertyPath); }
public static URI getConnectionState(Dataset connectionDataset, URI connectionUri) { Path statePath = PathParser.parse("won:hasConnectionState", DefaultPrefixUtils.getDefaultPrefixes()); return RdfUtils.getURIPropertyForPropertyPath(connectionDataset, connectionUri, statePath); }
public static URI getConnectionStateforConnectionURI(URI connectionURI, LinkedDataSource linkedDataSource) { assert linkedDataSource != null : "linkedDataSource must not be null"; Dataset dataset = getDatalForResource(connectionURI, linkedDataSource); Path propertyPath = PathParser.parse("<" + WON.HAS_CONNECTION_STATE+ ">", PrefixMapping.Standard); return RdfUtils.getURIPropertyForPropertyPath(dataset, connectionURI, propertyPath); }
public static URI getNeedURIforConnectionURI(URI connectionURI, LinkedDataSource linkedDataSource) { assert linkedDataSource != null : "linkedDataSource must not be null"; Dataset dataset = getDatalForResource(connectionURI, linkedDataSource); Path propertyPath = PathParser.parse("<" + WON.BELONGS_TO_NEED + ">", PrefixMapping.Standard); return RdfUtils.getURIPropertyForPropertyPath(dataset, connectionURI, propertyPath); }
public static URI getRemoteNeedURIforConnectionURI(URI connectionURI, LinkedDataSource linkedDataSource) { assert linkedDataSource != null : "linkedDataSource must not be null"; Dataset dataset = getDatalForResource(connectionURI, linkedDataSource); Path propertyPath = PathParser.parse("<" + WON.HAS_REMOTE_NEED + ">", PrefixMapping.Standard); return RdfUtils.getURIPropertyForPropertyPath(dataset, connectionURI, propertyPath); }
public Set<String> getMatcherProtocolTopicNamesWithResource(URI resourceURI){ Set<String> activeMQMatcherProtocolTopicNames = new HashSet<>(); resourceURI = URI.create(resourceURI.toString()+pathInformation); for (int i = 0; i< matcherProtocolTopicList.size();i++){ try{ Path path = PathParser.parse(matcherProtocolTopicList.get(i),PrefixMapping.Standard); activeMQMatcherProtocolTopicNames.add(RdfUtils.getStringPropertyForPropertyPath( linkedDataSource.getDataForResource(resourceURI), resourceURI, path )); }catch (HttpClientErrorException e){ if (e.getStatusCode() == HttpStatus.NOT_FOUND){ return null; } else throw e; } } return activeMQMatcherProtocolTopicNames; } public void setLinkedDataSource(final LinkedDataSource linkedDataSource)
public final Set<String> getMatcherProtocolTopicNamesWithResource(URI resourceURI){ Set<String> activeMQMatcherProtocolTopicNames = new HashSet<>(); for (int i = 0; i< matcherProtocolTopicList.size();i++){ try{ Path path = PathParser.parse(matcherProtocolTopicList.get(i),PrefixMapping.Standard); activeMQMatcherProtocolTopicNames.add(RdfUtils.getStringPropertyForPropertyPath( linkedDataSource.getDataForResource(resourceURI), resourceURI, path )); }catch (HttpClientErrorException e){ if (e.getStatusCode() == HttpStatus.NOT_FOUND){ return null; } else throw e; } } return activeMQMatcherProtocolTopicNames; }
private Node getContentPropertyObject(NeedContentPropertyType type, String propertyPath) { Path path = PathParser.parse(propertyPath, DefaultPrefixUtils.getDefaultPrefixes()); Collection<Resource> nodes = getContentNodes(type); if (nodes.size() != 1) { throw new IncorrectPropertyCountException("expected exactly one occurrence of object for property path " + propertyPath, 1, nodes.size()); } Node node = nodes.iterator().next().asNode(); return RdfUtils.getNodeForPropertyPath(getNeedModel(), node, path); }
String rdfPropertyStr = iri.value(); result = (P_Path0)PathParser.parse(rdfPropertyStr, pm);
try{ logger.debug("trying to get queue name prototol type {} on resource {}", protocolType, resourceUri); Path path = PathParser.parse(queueNamePath, PrefixMapping.Standard);
final Path p = PathParser.parse((String) o, pMapping); if (p instanceof P_Link)
final Path p = PathParser.parse((String) o, pMapping); if (p instanceof P_Link)
private static void test(Graph graph, Node start, String string, Node[] expectedNodes, boolean directionForward, boolean ordered) { Path p = PathParser.parse(string, pmap) ; Iterator<Node> resultsIter = directionForward ? PathEval.eval(graph, start, p, ARQ.getContext()) : PathEval.evalReverse(graph, start, p, ARQ.getContext()) ; List<Node> results = Iter.toList(resultsIter) ; List<Node> expected = Arrays.asList(expectedNodes) ; Assert.assertTrue("expected:"+expected+", got:"+results, equalsUnordered(expected, results)) ; if ( ordered ) Assert.assertEquals("expected(ordered)", expected, results) ; } }
private void parse(String string, boolean expectLegal) { Prologue prologue = new Prologue(pmap) ; Path p = null ; try { p = PathParser.parse(string, prologue) ; // System.out.println(string+" ==> "+p.toString(new Prologue(pmap))) ; // System.out.println(PathWriterSSE.asString(p, new Prologue(pmap))) ; if ( ! expectLegal ) fail("Expected error; "+string) ; } catch (QueryParseException ex) { if ( expectLegal ) fail("Expected success: "+string+": "+ex.getMessage()) ; return ; } String x = p.toString(prologue) ; Path p2 = PathParser.parse(x, prologue) ; assertEquals(p, p2) ; String sse = WriterPath.asString(p, prologue) ; Item item = SSE.parseItem(sse, pmap) ; p2 = BuilderPath.buildPath(item) ; assertEquals(p, p2) ; }