@Override public int compare(IRI uri1, IRI uri2) { return uri1.getLocalName().compareTo(uri2.getLocalName()); } });
public void addURI(final IRI uri) { // If possible, add a qualified name as well. String prefix = uriToPrefix.get(uri.getNamespace()); if (null != prefix) { String qName = prefix + ":" + uri.getLocalName(); allQNames.add(qName); } }
public String getName(IRI IRI) { String name = uriToString.get(IRI); if (name == null && SPIN.NAMESPACE.equals(IRI.getNamespace()) && IRI.getLocalName().startsWith("_arg")) { String lname = IRI.getLocalName(); try { Integer.parseInt(lname.substring("_arg".length())); name = lname.substring(1); } catch (NumberFormatException nfe) { // ignore - not a well-known argN variable } } return name; } }
private static void addBindings(Query query, List<Argument> arguments, Value... args) { for(int i=0; i<args.length; i++) { Argument argument = arguments.get(i); query.setBinding(argument.getPredicate().getLocalName(), args[i]); } } }
private static void addBindings(Query query, List<Argument> arguments, Value... args) { for(int i=0; i<args.length; i++) { Argument argument = arguments.get(i); query.setBinding(argument.getPredicate().getLocalName(), args[i]); } } }
public String findSymbol(final IRI uri) { // Does it have a keyword? String symbol = uriToKeyword.get(uri); // If not, does it have a namespace prefix? if (null == symbol) { String nsPrefix = uriToPrefix.get(uri.getNamespace()); // Namespace prefix may be empty but non-null. if (null != nsPrefix) { String localName = uri.getLocalName(); // Note: assumes that the local name is never null (although it // may be empty). symbol = (isValidPrefix(nsPrefix) && isValidLocalName(localName)) ? nsPrefix + ":" + uri.getLocalName() : null; } } return symbol; }
public GesturalServer(final int port, final Consumer<Dataset> datasetHandler) { this.port = port; // TODO: host and port are temporary; they should be configurable try { notificationSender = new UdpOscSender("localhost", 42003); } catch (UnknownHostException | SocketException e) { throw new IllegalStateException(); } HandshakeMatcher.HandshakeHandler handshakeHandler = (left, right, timestamp) -> { notifyOfInteraction(SmSnActivityOntology.EXO_ACTIVITY_HANDSHAKE); Dataset d = Activities.datasetForHandshakeInteraction(timestamp, left.actor, right.actor); datasetHandler.accept(d); speakWithSystemCall(left.actor.getLocalName() + " shook hands with " + right.actor.getLocalName()); }; handshakeMatcher = new HandshakeMatcher(handshakeHandler); HandoffMatcher.HandoffHandler handoffHandler = (give, take, thingGiven, timestamp) -> { notifyOfInteraction(SmSnActivityOntology.EXO_ACTIVITY_HANDOFF); Dataset d = Activities.datasetForHandoffInteraction(timestamp, give.actor, take.actor, thingGiven); datasetHandler.accept(d); speakWithSystemCall(give.actor.getLocalName() + " gave \"" + thingGiven.getLocalName() + "\" to " + take.actor.getLocalName()); }; handoffMatcher = new HandoffMatcher(handoffHandler); HighFiveMatcher.HighFiveHandler highFiveHandler = (left, right, time) -> { notifyOfInteraction(SmSnActivityOntology.EXO_ACTIVITY_HIGHFIVE); speakWithSystemCall(left.actor.getLocalName() + " high-fived " + right.actor.getLocalName()); }; highFiveMatcher = new HighFiveMatcher(highFiveHandler); }
if (key instanceof IRI) { String keyword = ((IRI) key).getLocalName();
public Value evaluate(LocalName node, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException { Value argValue = evaluate(node.getArg(), bindings); if (argValue instanceof IRI) { IRI uri = (IRI)argValue; return tripleSource.getValueFactory().createLiteral(uri.getLocalName()); } else { throw new ValueExprEvaluationException(); } }
code = funcUri.getLocalName();
public void apply(final RippleList arg, final Sink<RippleList> solutions, final ModelConnection mc) throws RippleException { Model model = mc.getModel(); if (model instanceof SesameModel) { Object head = arg.getFirst(); final RippleList rest = arg.getRest(); final Sink<Object> pushSink = v -> solutions.accept(rest.push(v)); Sink<Statement> stSink = st -> { if ('_' == st.getPredicate().getLocalName().charAt(0)) { pushSink.accept(st.getObject()); } }; mc.getStatements(mc.toRDF(head), null, null, stSink); } else { logger.warn("primitive is compatible only with the Sesame model: " + this); } } }
args.addBinding(argPred.getLocalName(), argValue);
@Override public void parse(Model graph, Resource implNode) throws SailConfigException { super.parse(graph, implNode); Literal indexDirLit = Models.objectLiteral(graph.filter(implNode, INDEX_DIR, null)).orElseThrow( () -> new SailConfigException("no value found for " + INDEX_DIR)); setIndexDir(indexDirLit.getLabel()); for (Statement stmt : graph.filter(implNode, null, null)) { if (stmt.getPredicate().getNamespace().equals(LuceneSailConfigSchema.NAMESPACE)) { if (stmt.getObject() instanceof Literal) { String key = stmt.getPredicate().getLocalName(); setParameter(key, stmt.getObject().stringValue()); } } } } }
jsArg = arg.stringValue(); bindings.put(argument.getPredicate().getLocalName(), jsArg);
private void namespaceTest(final String uri, final String ns, final String localName, final ModelConnection mc) throws Exception { IRI uriCreated = createIRI(uri, mc); String nsCreated = uriCreated.getNamespace(); String localNameCreated = uriCreated.getLocalName(); assertEquals(uriCreated.toString(), uri); assertEquals(nsCreated, ns); assertEquals(localNameCreated, localName); }
localName = uri.getLocalName(); namespace = uri.getNamespace(); assertEquals(localName, "bar"); localName = uri.getLocalName(); namespace = uri.getNamespace(); assertEquals(localName, ""); localName = uri.getLocalName(); namespace = uri.getNamespace(); assertEquals(localName, "bar"); localName = uri.getLocalName(); namespace = uri.getNamespace(); assertEquals(localName, ""); localName = uri.getLocalName(); namespace = uri.getNamespace(); assertEquals(localName, "bar"); localName = uri.getLocalName(); namespace = uri.getNamespace(); assertEquals(localName, "");