@Override
  public final NodeValue exec(List<NodeValue> args) {
    if (args == null)
      // The contract on the function interface is that this should not happen.
      throw new ARQInternalErrorException("Function '" + Utils.className(this) + " Null args list");

    if (args.size() != 0)
      throw new ExprEvalException(
          "Function '" + Utils.className(this) + " Wanted 0, got " + args.size());

    return exec();
  }
  public static void main(String[] a) throws Exception {
    System.out.println("ARQ Example: " + Utils.classShortName(ExLucene3.class));
    System.out.println("ARQ: " + ARQ.VERSION);
    System.out.println();

    Model model = ModelFactory.createDefaultModel();
    IndexLARQ index = buildTitleIndex(model, "src/test/resources/LARQ/data-1.ttl");

    // Search for string
    String searchString = "+document";

    // This time, find documents with a matching DC title.
    String queryString =
        StrUtils.strjoin(
            "\n",
            "PREFIX pf:     <http://jena.hpl.hp.com/ARQ/property#>",
            "PREFIX xsd:    <http://www.w3.org/2001/XMLSchema#>",
            "PREFIX dc:     <http://purl.org/dc/elements/1.1/>",
            "PREFIX :       <http://example/>",
            "SELECT ?title {",
            "    ?title pf:textMatch '" + searchString + "'.",
            "}");

    // Two of three documents should match.
    ExLucene1.performQuery(model, index, queryString);
    index.close();
  }
 @Override
 protected void details(IndentedWriter out, SerializationContext sCxt) {
   out.println(Utils.className(this));
   out.incIndent();
   op.output(out, sCxt);
   out.decIndent();
 }
  public boolean equiv(BasicPattern other, NodeIsomorphismMap isoMap) {
    if (this.triples.size() != other.triples.size()) return false;

    for (int i = 0; i < this.triples.size(); i++) {
      Triple t1 = get(i);
      Triple t2 = other.get(i);

      if (!Utils.tripleIso(t1, t2, isoMap)) return false;
    }
    return true;
  }
  public boolean equiv(PathBlock other, NodeIsomorphismMap isoMap) {
    if (this.triplePaths.size() != other.triplePaths.size()) return false;

    for (int i = 0; i < this.triplePaths.size(); i++) {
      TriplePath tp1 = get(i);
      TriplePath tp2 = other.get(i);

      if (!Utils.triplePathIso(tp1, tp2, isoMap)) return false;
    }
    return true;
  }
  @Override
  public boolean equals(Object other) {
    if (this == other) return true;

    if (!(other instanceof SortCondition)) return false;

    SortCondition sc = (SortCondition) other;

    if (sc.getDirection() != this.getDirection()) return false;

    if (!Utils.equal(this.getExpression(), sc.getExpression())) return false;

    //        if ( ! Utils.eq(this.getVariable(), sc.getVariable()) )
    //            return false ;

    return true;
  }
  // Do better
  @Override
  public void output(IndentedWriter out, SerializationContext sCxt) {
    out.println(Utils.className(this));
    out.incIndent();

    out.print(Plan.startMarker);
    out.incIndent();
    getLeft().output(out, sCxt);
    out.decIndent();
    // out.ensureStartOfLine() ;
    out.println(Plan.finishMarker);

    out.print(Plan.startMarker);
    out.incIndent();
    getRight().output(out, sCxt);
    out.decIndent();
    // out.ensureStartOfLine() ;
    out.println(Plan.finishMarker);

    out.decIndent();
  }
Exemple #8
0
 @Override
 protected String getCommandName() {
   return Utils.className(this);
 }
 @Override
 public void checkBuild(String uri, ExprList args) {
   if (args.size() != 0)
     throw new QueryBuildException("Function '" + Utils.className(this) + "' takes no arguments");
 }
 protected void details(IndentedWriter out, SerializationContext sCxt) {
   out.println(Utils.className(this));
 }
 @Override
 public boolean equalTo(Path path2, NodeIsomorphismMap isoMap) {
   if (!(path2 instanceof P_ReverseLink)) return false;
   P_ReverseLink other = (P_ReverseLink) path2;
   return Utils.nodeIso(node, other.node, isoMap);
 }
 @Override
 protected String getCommandName() {
   return Utils.classShortName(riot.class);
 }