⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rqlparser.java

📁 这是外国一个开源推理机
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                                                sourceFromTo.dataVar, propVar, targetFromTo.dataVar,                                                extendedPropInterpretation);                                _unboundVarList.remove(sourceFromTo.dataVar);                                _unboundVarList.remove(propVar);                                _unboundVarList.remove(targetFromTo.dataVar);                                selectors.add(dps);                        }                        // If appropriate, create DomainSelector                        if (sourceFromTo.classQ != null) {                                DomainSelector domainSel = new DomainSelector(                                                sourceFromTo.classQ, propVar);                                _unboundVarList.remove(propVar);                                _unboundVarList.remove(sourceFromTo.classQ);                                selectors.add(domainSel);                        }                        // If appropriate, create RangeSelector                        if (targetFromTo.classQ != null) {                                RangeSelector rangeSel = new RangeSelector(                                                propVar, targetFromTo.classQ);                                _unboundVarList.remove(propVar);                                _unboundVarList.remove(targetFromTo.classQ);                                selectors.add(rangeSel);                        }                }                // Return target FromTo for implicit join with next path element                {if (true) return targetFromTo;}    throw new Error("Missing return statement in function");  }/* * A path element whose domain is joined with the range of another * using a ".". The supplied sourceFromTo containing the range of the * other path element must never be null. */  final public FromTo joined_pathelem(List selectors, FromTo sourceFromTo) throws ParseException {        FromTo targetFromTo = null;        PropertyQuery propQ = null;    jj_consume_token(DOT);    propQ = ext_property_query();    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case LBRACE:      jj_consume_token(LBRACE);      targetFromTo = from_to(selectors);      jj_consume_token(RBRACE);      break;    default:      jj_la1[15] = jj_gen;      ;    }                // targetFromTo must always be present for implicit joins                // with next path element:                if (targetFromTo == null) {                        targetFromTo = new FromTo();                }                // In case just one of the FromTo's has a dataVar, the other                // should get an anonymous DataVar.                if (sourceFromTo.dataVar != null) {                        if (targetFromTo.dataVar == null) {                                targetFromTo.dataVar = new DataVar(getAnonymousVarName());                                if (targetFromTo.classQ != null) {                                        // We've created a new class restriction                                        InstanceSelector resSel = new InstanceSelector(                                                        targetFromTo.dataVar, targetFromTo.classQ,                                                        true);                                        _unboundVarList.remove(targetFromTo.dataVar);                                        _unboundVarList.remove(targetFromTo.classQ);                                        selectors.add(resSel);                                }                        }                }                else { // sourceFromTo.dataVar == null                        if (targetFromTo.dataVar != null) { //                                sourceFromTo.dataVar = new DataVar(getAnonymousVarName());                                if (sourceFromTo.classQ != null) {                                        // We've created a new class restriction                                        InstanceSelector resSel = new InstanceSelector(                                                        sourceFromTo.dataVar, sourceFromTo.classQ,                                                        true);                                        _unboundVarList.remove(sourceFromTo.dataVar);                                        _unboundVarList.remove(sourceFromTo.classQ);                                        selectors.add(resSel);                                }                        }                }                // Create a property selector for the property in case propQ                // is not a PropertyVar itself                PropertyVar propVar = null;                if (propQ instanceof PropertyVar) {                        propVar = (PropertyVar)propQ;                }                else {                        // Use anonymous var that can be shared with other selectors                        propVar = new PropertyVar(getAnonymousVarName());                        PropertySelector propSel = new PropertySelector(propVar, propQ);                        _unboundVarList.remove(propQ);                        selectors.add(propSel);                }                // If appropriate, create DataPathSelector                if (targetFromTo.dataVar != null) {                        boolean extendedPropInterpretation = true;                        if (propQ instanceof PropertyVar) {                                extendedPropInterpretation = false;                        }                        DataPathSelector dps = new DataPathSelector(                                        sourceFromTo.dataVar, propVar, targetFromTo.dataVar,                                        extendedPropInterpretation);                        _unboundVarList.remove(sourceFromTo.dataVar);                        _unboundVarList.remove(propVar);                        _unboundVarList.remove(targetFromTo.dataVar);                        selectors.add(dps);                }                // If appropriate, create DomainSelector                if (sourceFromTo.classQ != null) {                        DomainSelector domainSel = new DomainSelector(                                        sourceFromTo.classQ, propVar);                        _unboundVarList.remove(propVar);                        _unboundVarList.remove(sourceFromTo.classQ);                        selectors.add(domainSel);                }                // If appropriate, create RangeSelector                if (targetFromTo.classQ != null) {                        RangeSelector rangeSel = new RangeSelector(                                        propVar, targetFromTo.classQ);                        _unboundVarList.remove(propVar);                        _unboundVarList.remove(targetFromTo.classQ);                        selectors.add(rangeSel);                }                // Return target FromTo for implicit join with next path element                {if (true) return targetFromTo;}    throw new Error("Missing return statement in function");  }  final public FromTo from_to(List selectors) throws ParseException {        FromTo result = new FromTo();    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case IDENTIFIER:      result.dataVar = datavar();      break;    default:      jj_la1[16] = jj_gen;      ;    }    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case COLON:      jj_consume_token(COLON);      result.classQ = schema_part();      break;    default:      jj_la1[17] = jj_gen;      ;    }                if (result.dataVar != null && result.classQ != null) {                    // if of the form {X : someClass} do extended                    // interpretation, but if the schema constraint is                    // more complex do restricted interpretation.                    boolean properInstancesOnly = true;                    if (result.classQ instanceof URI) {                        properInstancesOnly = false;                    }                    InstanceSelector resSel = new InstanceSelector(                            result.dataVar, result.classQ,                            properInstancesOnly);                    _unboundVarList.remove(result.dataVar);                    _unboundVarList.remove(result.classQ);                    selectors.add(resSel);                }                {if (true) return result;}    throw new Error("Missing return statement in function");  }  final public ClassQuery schema_part() throws ParseException {        ClassQuery result;    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case CLASSVAR:      result = classvar();                              {if (true) return result;}      break;    case URI:      result = uri();                         {if (true) return result;}      break;    default:      jj_la1[18] = jj_gen;      jj_consume_token(-1);      throw new ParseException();    }    throw new Error("Missing return statement in function");  }/*-------------------------------------------------+| DATA QUERIES                                     |+-------------------------------------------------*/  final public DataQuery ext_data_query() throws ParseException {        DataQuery result;    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case URI:      result = uri();                         {if (true) return result;}      break;    case CIRCUMFLEX:    case IDENTIFIER:      result = data_query();                                {if (true) return result;}      break;    default:      jj_la1[19] = jj_gen;      jj_consume_token(-1);      throw new ParseException();    }    throw new Error("Missing return statement in function");  }  final public DataQuery data_query() throws ParseException {        ResourceQuery result;    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case IDENTIFIER:      result = datavar();          {if (true) return (DataQuery)result;}      break;    case CIRCUMFLEX:      result = proper_instances();      result = array_selection(result);          {if (true) return (DataQuery)result;}      break;    default:      jj_la1[20] = jj_gen;      jj_consume_token(-1);      throw new ParseException();    }    throw new Error("Missing return statement in function");  }  final public DataQuery proper_instances() throws ParseException {        ClassQuery cq;    jj_consume_token(CIRCUMFLEX);    cq = ext_class_query();          {if (true) return new InstanceOf(cq, true);}    throw new Error("Missing return statement in function");  }/*-------------------------------------------------+| CLASS QUERIES                                    |+-------------------------------------------------*//* Extended class query = class_query + schemavar + uri */  final public ClassQuery ext_class_query() throws ParseException {        ResourceQuery result;    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case URI:      result = uri();          {if (true) return (ClassQuery)result;}      break;    case CLASS:    case TYPEOF:    case SUBCLASSOF:    case SUPERCLASSOF:    case DOMAIN:    case RANGE:    case CLASSVAR:      result = class_query();          {if (true) return (ClassQuery)result;}      break;    default:      jj_la1[21] = jj_gen;      jj_consume_token(-1);      throw new ParseException();    }    throw new Error("Missing return statement in function");  }  final public ClassQuery class_query() throws ParseException {        ResourceQuery result;    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case TYPEOF:      result = typeOf();      result = array_selection(result);          {if (true) return (ClassQuery)result;}      break;    case SUBCLASSOF:      result = subClassOf();      result = array_selection(result);          {if (true) return (ClassQuery)result;}      break;    case SUPERCLASSOF:      result = superClassOf();      result = array_selection(result);          {if (true) return (ClassQuery)result;}      break;    case DOMAIN:      result = domain();                            {if (true) return (ClassQuery)result;}      break;    case RANGE:      result = range();                           {if (true) return (ClassQuery)result;}      break;    case CLASSVAR:      result = classvar();                              {if (true) return (ClassQuery)result;}      break;    case CLASS:      result = rdfs_class();      result = array_selection(result);          {if (true) return (ClassQuery)result;}      break;    default:      jj_la1[22] = jj_gen;      jj_consume_token(-1);      throw new ParseException();    }    throw new Error("Missing return statement in function");  }  final public ClassQuery typeOf() throws ParseException {        ResourceQuery rq;        Token t = null;    jj_consume_token(TYPEOF);    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case CIRCUMFLEX:      t = jj_consume_token(CIRCUMFLEX);      break;    default:      jj_la1[23] = jj_gen;      ;    }    jj_consume_token(LPAREN);    rq = typeOf_arg();    jj_consume_token(RPAREN);          {if (true) return new TypeOf(rq, (t == null));}    throw new Error("Missing return statement in function");  }  final public ResourceQuery typeOf_arg() throws ParseException {    ResourceQuery rq;    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {    case CIRCUMFLEX:    case IDENTIFIER:    case URI:      // FIXME why not just all resourcequeries?          rq = ext_data_query();                            {if (true) return rq;}      break;    case PROPERTY:    case SUBPROPERTYOF:    case SUPERPROPERTYOF:    case PROPERTYVAR:      rq = property_query();                            {if (true) return rq;}      break;    case CLASS:    case TYPEOF:    case SUBCLASSOF:    case SUPERCLASSOF:    case DOMAIN:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -