/** * Return a name for this selector to be used as the name for the whole path if not explicitly * specified. In complex selector expressions, this is typically delegated to the first * occurrence of an atomic selector. */ @Override public String getName(NodeBackend<Node> nodeRDFBackend) { return nodeRDFBackend.stringValue(property); }
public Node resolveResource(String uri) throws ParseException { return backend.createURI(uri); }
private Collection<Node> getFromContainer(RDFBackend<Node> backend, Node node, int index) { return backend.listObjects(node, backend.createURI(RDF + "_" + (index + 1))); }
@Override public String getPathExpression(NodeBackend<Node> rdfBackend) { if (rdfBackend.isURI(node)) { return String.format("is-a <%s>", rdfBackend.stringValue(node)); } else if (rdfBackend.isLiteral(node)) { return String.format("is-a \"%s\"", rdfBackend.stringValue(node)); } else { // TODO Can this happen? return String.format("is-a %s", rdfBackend.stringValue(node)); } }
/** * Transform the KiWiNode node into the datatype T. In case the node cannot be transformed to * the respective datatype, throws an IllegalArgumentException that needs to be caught by the class * carrying out the transformation. * * * @param backend * @param node * @return */ @Override public String transform(RDFBackend<Node> backend, Node node, Map<String, String> configuration) throws IllegalArgumentException { return backend.stringValue(node); } }
@Override public String getAsString() throws TemplateModelException { return backend.getLiteralType(node).toString(); } };
@Override public String getPathExpression(NodeBackend<Node> rdfBackend) { if (rdfBackend.isURI(node)) { return String.format("is-a <%s>", rdfBackend.stringValue(node)); } else if (rdfBackend.isLiteral(node)) { return String.format("is-a \"%s\"", rdfBackend.stringValue(node)); } else { // TODO Can this happen? return String.format("is-a %s", rdfBackend.stringValue(node)); } }
private Collection<Node> getFromContainer(RDFBackend<Node> backend, Node node, int index) { return backend.listObjects(node, backend.createURI(RDF + "_" + (index + 1))); }
@Override public String getAsString() throws TemplateModelException { return backend.stringValue(node); } };
/** * Transform the KiWiNode node into the datatype T. In case the node cannot be transformed to * the respective datatype, throws an IllegalArgumentException that needs to be caught by the class * carrying out the transformation. * * * @param backend * @param node * @return */ @Override public String transform(RDFBackend<Node> backend, Node node, Map<String, String> configuration) throws IllegalArgumentException { return backend.stringValue(node); } }
public Node resolveResource(String uri) throws ParseException { return backend.createURI(uri); }
private void flattenContainer(RDFBackend<Node> backend, Node node, Collection<Node> result) { for (int i = 1; /* exit via break */; i++) { final Collection<Node> objects = backend.listObjects(node, backend.createURI(RDF + "_" + i)); if (objects.size() > 0) { result.addAll(objects); } else { break; } } }
@Override public String getAsString() throws TemplateModelException { return backend.stringValue(node); } };
private void flattenContainer(RDFBackend<Node> backend, Node node, Collection<Node> result) { for (int i = 1; /* exit via break */; i++) { final Collection<Node> objects = backend.listObjects(node, backend.createURI(RDF + "_" + i)); if (objects.size() > 0) { result.addAll(objects); } else { break; } } }
/** * Return a name for this selector to be used as the name for the whole path if not explicitly * specified. In complex selector expressions, this is typically delegated to the first * occurrence of an atomic selector. */ @Override public String getName(NodeBackend<Node> nodeRDFBackend) { return nodeRDFBackend.stringValue(property); }
@Override public String getPathExpression(NodeBackend<Node> backend) { if (property != null) { return String.format("<%s>", backend.stringValue(property)); } else { return "*"; } }
@Override public String getPathExpression(NodeBackend<Node> backend) { if (property != null) { return String.format("^<%s>", backend.stringValue(property)); } else { return "^*"; } }
@Override public String getPathExpression(NodeBackend<Node> backend) { if (property != null) { return String.format("<%s>", backend.stringValue(property)); } else { return "*"; } }
/** * Return a name for this selector to be used as the name for the whole path if not explicitly * specified. In complex selector expressions, this is typically delegated to the first * occurrence of an atomic selector. */ @Override public String getName(NodeBackend<Node> backend) { if(property != null) { return backend.stringValue(property); } else { throw new UnsupportedOperationException("cannot use wildcards in unnamed field definitions because the name is undefined"); } }
@Override public String getPathExpression(NodeBackend<Node> backend) { if (property != null) { return String.format("^<%s>", backend.stringValue(property)); } else { return "^*"; } }