Package lupos.rif.model

Examples of lupos.rif.model.Document


   * Prefix -> Namespace
   */
  public Map<String, String> prefixMap = null;

  public Object visit(final CompilationUnit n, final IRuleNode argu) {
    final Document resultDoc = (Document) n.f0.accept(this, null);
    return resultDoc;
  }
View Full Code Here


    final Document resultDoc = (Document) n.f0.accept(this, null);
    return resultDoc;
  }

  public Object visit(final RIFDocument n, final IRuleNode argu) {
    final Document doc = new Document();
    doc.setParent(argu);

    final Constant baseNS = (Constant) n.f2.accept(this, doc);
    doc.setBaseNamespace(baseNS != null ? ((URILiteral) baseNS.getLiteral())
        .getString() : null);
    baseNamespace = doc.getBaseNamespace();

    for (final INode node : (List<INode>) n.f3.accept(this, doc)) {
      final String[] prefix = (String[]) node.accept(this, doc);
      doc.getPrefixMap().put(prefix[0], prefix[1]);
    }
    // standardprefixe
    if (!doc.getPrefixMap().containsKey("rif"))
      doc.getPrefixMap().put("rif", "http://www.w3.org/2007/rif#");
    if (!doc.getPrefixMap().containsKey("xs"))
      doc.getPrefixMap().put("xs", "http://www.w3.org/2001/XMLSchema#");
    if (!doc.getPrefixMap().containsKey("rdfs"))
      doc.getPrefixMap().put("rdfs",
          "http://www.w3.org/2000/01/rdf-schema#");
    if (!doc.getPrefixMap().containsKey("rdf"))
      doc.getPrefixMap().put("rdf",
          "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
    prefixMap = new HashMap<String, String>(doc.getPrefixMap());
    doc.setConclusion((IExpression) n.f5.accept(this, doc));
    final List<Rule> ruleList = (List<Rule>) n.f6.accept(this, doc);
    if (ruleList != null) {
      for (final Rule rule : ruleList)
        if (!rule.isImplication()
            && rule.getDeclaredVariables().isEmpty())
          doc.getFacts().add(rule.getHead());
        else
          doc.getRules().add(rule);
    }
    return doc;
  }
View Full Code Here

TOP

Related Classes of lupos.rif.model.Document

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.