用antlr文法编写的hermit swrl规则(分享)

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

grammar HermitRule;

axioms : ( axiom | ruleN | dGAxiom )*;
ruleN : dLSafeRule | dGRule;
dLSafeRule : DL_SAFE_RULE ‘(‘ annotation* BODY ‘(‘ atom* ‘)‘
HEAD ‘(‘ head ‘)‘ ‘)‘;

head: atom*;
axiom : declaration | classAxiom | objectPropertyAxiom | dataPropertyAxiom | datatypeDefinition | hasKey | assertion | annotationAxiom;
declaration: DECLARATION ‘(‘ axiomAnnotations entity ‘)‘;

entity: class_entity | data_type_entity | object_property_entity
| data_property_entity | annotation_property_entity | named_individual_entity;
class_entity:CLASS ‘(‘ classN ‘)‘;
data_type_entity:DATA_TYPE ‘(‘ datatype ‘)‘;
object_property_entity:OBJECT_PROPERTY ‘(‘ objectProperty ‘)‘;
data_property_entity:DATA_PROPERTY ‘(‘ dataProperty ‘)‘;
annotation_property_entity:ANNOTATION_PROPERTY ‘(‘ annotationProperty ‘)‘;
named_individual_entity:NAMED_INDIVIDUAL ‘(‘ namedIndividual ‘)‘;

classAxiom:subClassOf | equivalentClasses | disjointClasses | disjointUnion;
subClassOf:SUB_CLASS_OF ‘(‘ axiomAnnotations subClassExpression superClassExpression ‘)‘;
equivalentClasses:EQUIVALENT_CLASSES ‘(‘ axiomAnnotations classExpression classExpression classExpression* ‘)‘;
subClassExpression : classExpression;
superClassExpression:classExpression;
disjointClasses:DISJOINT_CLASSES ‘(‘ axiomAnnotations classExpression classExpression classExpression* ‘)‘;
disjointUnion:DISJOINT_UNION ‘(‘ axiomAnnotations classN disjointClassExpressions ‘)‘;
disjointClassExpressions:classExpression classExpression classExpression*;
objectPropertyAxiom:
subObjectPropertyOf | equivalentObjectProperties |
disjointObjectProperties | inverseObjectProperties |
objectPropertyDomain | objectPropertyRange |
functionalObjectProperty | inverseFunctionalObjectProperty |
reflexiveObjectProperty | irreflexiveObjectProperty |
symmetricObjectProperty | asymmetricObjectProperty |
transitiveObjectProperty;
subObjectPropertyOf:SUB_OBJECT_PROPERTY_OF ‘(‘ axiomAnnotations subObjectPropertyExpression superObjectPropertyExpression ‘)‘;
subObjectPropertyExpression:objectPropertyExpression | propertyExpressionChain;
propertyExpressionChain:OBJECT_PROPERTY_CHAIN ‘(‘ objectPropertyExpression objectPropertyExpression objectPropertyExpression* ‘)‘;
superObjectPropertyExpression:objectPropertyExpression;
equivalentObjectProperties:EQUIVALENT_OBJECT_PROPERTIES ‘(‘ axiomAnnotations objectPropertyExpression objectPropertyExpression objectPropertyExpression* ‘)‘;
disjointObjectProperties:DISJOINT_OBJECT_PROPERTIES ‘(‘ axiomAnnotations objectPropertyExpression objectPropertyExpression objectPropertyExpression* ‘)‘;

objectPropertyDomain : OBJECT_PROPERTY_DOMAIN ‘(‘ axiomAnnotations objectPropertyExpression classExpression ‘)‘;

objectPropertyRange : OBJECT_PROPERTY_RANGE ‘(‘ axiomAnnotations objectPropertyExpression classExpression ‘)‘;

inverseObjectProperties : INVERSE_OBJECT_PROPERTIES ‘(‘ axiomAnnotations objectPropertyExpression objectPropertyExpression ‘)‘;

functionalObjectProperty : FUNCTIONAL_OBJECT_PROPERTY ‘(‘ axiomAnnotations objectPropertyExpression ‘)‘;

inverseFunctionalObjectProperty : INVERSE_FUNCTIONAL_OBJECT_PROPERTY ‘(‘ axiomAnnotations objectPropertyExpression ‘)‘;

reflexiveObjectProperty : REFLEXIVE_OBJECT_PROPERTY ‘(‘ axiomAnnotations objectPropertyExpression ‘)‘;

irreflexiveObjectProperty : IRREFLEXIVE_OBJECT_PROPERTY ‘(‘ axiomAnnotations objectPropertyExpression ‘)‘;

symmetricObjectProperty : SYMMETRIC_OBJECT_PROPERTY ‘(‘ axiomAnnotations objectPropertyExpression ‘)‘;

asymmetricObjectProperty : ASYMMETRIC_OBJECT_PROPERTY ‘(‘ axiomAnnotations objectPropertyExpression ‘)‘;

transitiveObjectProperty : TRANSITIVE_OBJECT_PROPERTY ‘(‘ axiomAnnotations objectPropertyExpression ‘)‘;

dataPropertyAxiom :
subDataPropertyOf | equivalentDataProperties | disjointDataProperties |
dataPropertyDomain | dataPropertyRange | functionalDataProperty;

subDataPropertyOf : SUB_DATA_PROPERTY_OF ‘(‘ axiomAnnotations subDataPropertyExpression superDataPropertyExpression ‘)‘;
subDataPropertyExpression : dataPropertyExpression;
superDataPropertyExpression : dataPropertyExpression;

equivalentDataProperties : EQUIVALENT_DATA_PROPERTIES ‘(‘ axiomAnnotations dataPropertyExpression dataPropertyExpression dataPropertyExpression* ‘)‘;

disjointDataProperties : DISJOINT_DATA_PROPERTIES ‘(‘ axiomAnnotations dataPropertyExpression dataPropertyExpression dataPropertyExpression* ‘)‘;

dataPropertyDomain : DATA_PROPERTY_DOMAIN ‘(‘ axiomAnnotations dataPropertyExpression classExpression ‘)‘;

dataPropertyRange : DATA_PROPERTY_RANGE ‘(‘ axiomAnnotations dataPropertyExpression dataRange ‘)‘;

functionalDataProperty :FUNCTIONAL_DATA_PROPERTY ‘(‘ axiomAnnotations dataPropertyExpression ‘)‘;

datatypeDefinition : DATATYPE_DEFINITION ‘(‘ axiomAnnotations datatype dataRange ‘)‘;

hasKey : HAS_KEY ‘(‘ axiomAnnotations classExpression ‘(‘ objectPropertyExpression* ‘)‘ ‘(‘ dataPropertyExpression* ‘)‘ ‘)‘;

atom:
class_atom | data_range_atom | object_property_atom
| data_property_atom | built_in_atom | same_individual_atom
| different_individuals_atom
;
class_atom:CLASS_ATOM ‘(‘ classExpression iArg ‘)‘;
data_range_atom:DATA_RANGE_ATOM ‘(‘ dataRange dArg ‘)‘;
object_property_atom:OBJECT_PROPERTY_ATOM ‘(‘ objectPropertyExpression iArg iArg ‘)‘;
data_property_atom:DATA_PROPERTY_ATOM ‘(‘ dataProperty iArg dArg ‘)‘;
built_in_atom:BUILT_IN_ATOM ‘(‘ iRI dArg dArg* ‘)‘;
same_individual_atom:SAME_INDIVIDUAL_ATOM ‘(‘ iArg iArg ‘)‘;
different_individuals_atom:DIFFERENT_INDIVIDUALS_ATOM ‘(‘ iArg iArg‘)‘;

iArg : VARIABLE ‘(‘ iRI ‘)‘ | individual;
dArg : VARIABLE ‘(‘ iRI ‘)‘ | literal;
dGRule : DESCRIPTION_GRAPH_RULE ‘(‘ annotation* BODY ‘(‘ dGAtom* ‘)‘
HEAD ‘(‘ headDGRule ‘)‘ ‘)‘;
headDGRule:dGAtom*;
dGAtom : CLASS_ATOM ‘(‘ classExpression iArg ‘)‘
| OBJECT_PROPERTY_ATOM ‘(‘ objectPropertyExpression iArg iArg ‘)‘;
dGAxiom : DESCRIPTION_GRAPH ‘(‘ annotation* dGNodes
dGEdges mainClasses‘)‘;
dGNodes : NODES‘(‘ nodeAssertion nodeAssertion* ‘)‘;
nodeAssertion : NODE_ASSERTION‘(‘ classN dGNode ‘)‘;
dGNode : iRI;
dGEdges : EDGES‘(‘ edgeAssertion edgeAssertion* ‘)‘;
edgeAssertion : EDGE_ASSERTION ‘(‘ objectProperty dGNode dGNode‘)‘;
mainClasses : MAIN_CLASSES ‘(‘ classN classN* ‘)‘;

annotationSubject : iRI | anonymousIndividual;
annotationValue : anonymousIndividual | iRI | literal;
axiomAnnotations : annotation*;

annotation : ANNOTATION ‘(‘ annotationAnnotations annotationProperty annotationValue ‘)‘;
annotationAnnotations : annotation*;
annotationProperty : iRI;
annotationAxiom : annotationAssertion | subAnnotationPropertyOf | annotationPropertyDomain | annotationPropertyRange;

annotationAssertion : ANNOTATION_ASSERTION ‘(‘ axiomAnnotations annotationProperty annotationSubject annotationValue ‘)‘;

subAnnotationPropertyOf : SUB_ANNOTATION_PROPERTY_OF ‘(‘ axiomAnnotations subAnnotationProperty superAnnotationProperty ‘)‘;
subAnnotationProperty : annotationProperty;
superAnnotationProperty : annotationProperty;

annotationPropertyDomain : ANNOTATION_PROPERTY_DOMAIN ‘(‘ axiomAnnotations annotationProperty iRI ‘)‘;

annotationPropertyRange : ANNOTATION_PROPERTY_RANGE ‘(‘ axiomAnnotations annotationProperty iRI ‘)‘ ;

classExpression: classN |
objectIntersectionOf | objectUnionOf | objectComplementOf | objectOneOf |
objectSomeValuesFrom | objectAllValuesFrom | objectHasValue | objectHasSelf |
objectMinCardinality | objectMaxCardinality | objectExactCardinality |
dataSomeValuesFrom | dataAllValuesFrom | dataHasValue |
dataMinCardinality | dataMaxCardinality | dataExactCardinality;

objectIntersectionOf : OBJECT_INTERSECTION_OF ‘(‘ classExpression classExpression classExpression* ‘)‘;

objectUnionOf : OBJECT_UNION_OF ‘(‘ classExpression classExpression classExpression* ‘)‘;

objectComplementOf : OBJECT_COMPLEMENT_OF ‘(‘ classExpression ‘)‘;

objectOneOf : OBJECT_ONE_OF ‘(‘ individual individual*‘)‘;

objectSomeValuesFrom : OBJECT_SOME_VALUES_FROM ‘(‘ objectPropertyExpression classExpression ‘)‘;

objectAllValuesFrom : OBJECT_ALL_VALUES_FROM ‘(‘ objectPropertyExpression classExpression ‘)‘;

objectHasValue : OBJECT_HAS_VALUE ‘(‘ objectPropertyExpression individual ‘)‘;

objectHasSelf : OBJECT_HAS_SELF ‘(‘ objectPropertyExpression ‘)‘;

objectMinCardinality : OBJECT_MIN_CARDINALITY ‘(‘ INTEGER objectPropertyExpression classExpression? ‘)‘;

objectMaxCardinality : OBJECT_MAX_CARDINALITY ‘(‘ INTEGER objectPropertyExpression classExpression ? ‘)‘;

objectExactCardinality : OBJECT_EXACT_CARDINALITY ‘(‘ INTEGER objectPropertyExpression classExpression? ‘)‘;

dataSomeValuesFrom : DATA_SOME_VALUES_FROM ‘(‘ dataPropertyExpression dataPropertyExpression* dataRange ‘)‘;

dataAllValuesFrom : DATA_ALL_VALUES_FROM ‘(‘ dataPropertyExpression dataPropertyExpression* dataRange ‘)‘;

dataHasValue : DATA_HAS_VALUE ‘(‘ dataPropertyExpression literal ‘)‘;

dataMinCardinality : DATA_MIN_CARDINALITY ‘(‘ INTEGER dataPropertyExpression dataRange? ‘)‘;

dataMaxCardinality : DATA_MAX_CARDINALITY ‘(‘ INTEGER dataPropertyExpression dataRange? ‘)‘;

dataExactCardinality : DATA_EXACT_CARDINALITY ‘(‘ INTEGER dataPropertyExpression dataRange? ‘)‘;

dataPropertyExpression : dataProperty;

assertion :
sameIndividual | differentIndividuals | classAssertion |
objectPropertyAssertion | negativeObjectPropertyAssertion |
dataPropertyAssertion | negativeDataPropertyAssertion;

sourceIndividual : individual;
targetIndividual : individual;
targetValue : literal;

sameIndividual : SAME_INDIVIDUAL ‘(‘ axiomAnnotations individual individual individual* ‘)‘;

differentIndividuals : DIFFERENT_INDIVIDUALS ‘(‘ axiomAnnotations individual individual individual* ‘)‘;

classAssertion : CLASS_ASSERTION ‘(‘ axiomAnnotations classExpression individual ‘)‘;

objectPropertyAssertion : OBJECT_PROPERTY_ASSERTION ‘(‘ axiomAnnotations objectPropertyExpression sourceIndividual targetIndividual ‘)‘;

negativeObjectPropertyAssertion : NEGATIVE_OBJECT_PROPERTY_ASSERTION ‘(‘ axiomAnnotations objectPropertyExpression sourceIndividual targetIndividual ‘)‘;

dataPropertyAssertion : DATA_PROPERTY_ASSERTION ‘(‘ axiomAnnotations dataPropertyExpression sourceIndividual targetValue ‘)‘;

negativeDataPropertyAssertion : NEGATIVE_DATA_PROPERTY_ASSERTION ‘(‘ axiomAnnotations dataPropertyExpression sourceIndividual targetValue ‘)‘ ;

dataRange :
datatype |
dataIntersectionOf |
dataUnionOf |
dataComplementOf |
dataOneOf |
datatypeRestriction ;
dataIntersectionOf : DATA_INTERSECTION_OF ‘(‘ dataRange dataRange dataRange* ‘)‘ ;
dataUnionOf : DATA_UNION_OF ‘(‘ dataRange dataRange dataRange* ‘)‘ ;
dataComplementOf : DATA_COMPLEMENT_OF ‘(‘ dataRange ‘)‘ ;
dataOneOf : DATA_ONE_OF ‘(‘ literal literal* ‘)‘ ;
datatype : iRI;
objectPropertyExpression : objectProperty | inverseObjectProperty;
inverseObjectProperty : OBJECT_INVERSE_OF ‘(‘ objectProperty ‘)‘;
datatypeRestriction : DATATYPE_RESTRICTION ‘(‘ datatype constrainingFacet restrictionValue ( constrainingFacet restrictionValue)* ‘)‘;
constrainingFacet : iRI ;
restrictionValue : literal;
dataProperty:iRI;
individual: namedIndividual | anonymousIndividual;
namedIndividual:iRI;
anonymousIndividual:BLANK_NODE_LABEL;
literal: String ( LANGTAG | xsdIri)? ;
String : STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 ;
classN:iRI;
objectProperty:iRI;
iRI: IRIREF | prefixedName ;
prefixedName : PNAME_LN | PNAME_NS ;
blankNode : BLANK_NODE_LABEL | ANON ;
xsdIri: ‘^^‘ (IRIREF | prefixedName);//PNAME_LN | PNAME_NS;
COMMENT:
(‘#‘ .*? (‘\r‘| ‘\r\n‘)) {skip();}
;
IRIREF : ‘<‘ (~[\u0000-\u0020<>"{}|^`\\])* ‘>‘ ;
PNAME_NS : PN_PREFIX? ‘:‘ ;
PNAME_LN : PNAME_NS PN_LOCAL ;
BLANK_NODE_LABEL : ‘_:‘ ( PN_CHARS_U | [0-9] ) ((PN_CHARS|‘.‘)* PN_CHARS)? ;
VAR1 : ‘?‘ VARNAME ;
VAR2 : ‘$‘ VARNAME ;
LANGTAG : ‘@‘ [a-zA-Z]+ (‘-‘ [a-zA-Z0-9]+)* ;
INTEGER : [0-9]+ ;
DECIMAL : [0-9]* ‘.‘ [0-9]+ ;
DOUBLE : [0-9]+ ‘.‘ [0-9]* EXPONENT | ‘.‘ ([0-9])+ EXPONENT | ([0-9])+ EXPONENT ;
INTEGER_POSITIVE : ‘+‘ INTEGER ;
DECIMAL_POSITIVE : ‘+‘ DECIMAL ;
DOUBLE_POSITIVE : ‘+‘ DOUBLE ;
INTEGER_NEGATIVE : ‘-‘ INTEGER ;
DECIMAL_NEGATIVE : ‘-‘ DECIMAL ;
DOUBLE_NEGATIVE : ‘-‘ DOUBLE ;
fragment EXPONENT : E [+-]? [0-9]+ ;
fragment STRING_LITERAL1 : QUOTE1 ( (~[\u0027\u005C\u000A\u000D]) | ECHAR )* QUOTE1 ;
fragment STRING_LITERAL2 : QUOTE2 ( (~[\u0022\u005C\u000A\u000D]) | ECHAR )* QUOTE2 ;
fragment STRING_LITERAL_LONG1 : ‘\‘\‘\‘‘ ( ( ‘\‘‘ | ‘\‘\‘‘ )? ( ~[\‘\\] | ECHAR ) )* ‘\‘\‘\‘‘ ;
fragment STRING_LITERAL_LONG2 : ‘"""‘ ( ( ‘"‘ | ‘""‘ )? ( ~["\\] | ECHAR ) )* ‘"""‘ ;
fragment ECHAR : ‘\\‘ [tbnrf\\"‘] ;
NIL : ‘(‘ WS* ‘)‘ ;
WS : (‘\u0020‘ | ‘\u0009‘ | ‘\u000D‘ | ‘\u000A‘) {skip();} ;
ANON : ‘[‘ WS* ‘]‘ ;

DL_SAFE_RULE:‘DLSafeRule‘;
BODY:‘Body‘;
HEAD:‘Head‘;
DECLARATION:‘Declaration‘;
CLASS:‘Class‘;
DATA_TYPE:‘Datatype‘;
OBJECT_PROPERTY:‘ObjectProperty‘;
DATA_PROPERTY:‘DataProperty‘;
ANNOTATION_PROPERTY:‘AnnotationProperty‘;
NAMED_INDIVIDUAL:‘NamedIndividual‘;
SUB_CLASS_OF:‘SubClassOf‘;
EQUIVALENT_CLASSES:‘EquivalentClasses‘;
DISJOINT_CLASSES:‘DisjointClasses‘;
DISJOINT_UNION:‘DisjointUnion‘;
SUB_OBJECT_PROPERTY_OF:‘SubObjectPropertyOf‘;
OBJECT_PROPERTY_CHAIN:‘ObjectPropertyChain‘;
EQUIVALENT_OBJECT_PROPERTIES:‘EquivalentObjectProperties‘;
DISJOINT_OBJECT_PROPERTIES:‘DisjointObjectProperties‘;
OBJECT_PROPERTY_DOMAIN:‘ObjectPropertyDomain‘;
OBJECT_PROPERTY_RANGE:‘ObjectPropertyRange‘;
INVERSE_OBJECT_PROPERTIES:‘InverseObjectProperties‘;
FUNCTIONAL_OBJECT_PROPERTY:‘FunctionalObjectProperty‘;
INVERSE_FUNCTIONAL_OBJECT_PROPERTY:‘InverseFunctionalObjectProperty‘;
REFLEXIVE_OBJECT_PROPERTY:‘ReflexiveObjectProperty‘;
IRREFLEXIVE_OBJECT_PROPERTY :‘IrreflexiveObjectProperty‘;
SYMMETRIC_OBJECT_PROPERTY:‘SymmetricObjectProperty‘;
ASYMMETRIC_OBJECT_PROPERTY:‘AsymmetricObjectProperty‘;
TRANSITIVE_OBJECT_PROPERTY:‘TransitiveObjectProperty‘;
SUB_DATA_PROPERTY_OF:‘SubDataPropertyOf‘;
EQUIVALENT_DATA_PROPERTIES:‘EquivalentDataProperties‘;
DISJOINT_DATA_PROPERTIES:‘DisjointDataProperties‘;
DATA_PROPERTY_DOMAIN:‘DataPropertyDomain‘;
DATA_PROPERTY_RANGE:‘DataPropertyRange‘;
FUNCTIONAL_DATA_PROPERTY:‘FunctionalDataProperty‘;
DATATYPE_DEFINITION:‘DatatypeDefinition‘;
HAS_KEY:‘HasKey‘;
CLASS_ATOM:‘ClassAtom‘;
DATA_RANGE_ATOM:‘DataRangeAtom‘;
OBJECT_PROPERTY_ATOM:‘ObjectPropertyAtom‘;
DATA_PROPERTY_ATOM:‘DataPropertyAtom‘;
BUILT_IN_ATOM:‘BuiltInAtom‘;
SAME_INDIVIDUAL_ATOM:‘SameIndividualAtom‘;
DIFFERENT_INDIVIDUALS_ATOM:‘DifferentIndividualsAtom‘;
VARIABLE:‘Variable‘;
DESCRIPTION_GRAPH_RULE:‘DescriptionGraphRule‘;
DESCRIPTION_GRAPH:‘DescriptionGraph‘;
NODES:‘Nodes‘;
NODE_ASSERTION:‘NodeAssertion‘;
EDGES:‘Edges‘;
EDGE_ASSERTION:‘EdgeAssertion‘;
MAIN_CLASSES:‘MainClasses‘;
ANNOTATION:‘Annotation‘;
ANNOTATION_ASSERTION:‘AnnotationAssertion‘;
SUB_ANNOTATION_PROPERTY_OF:‘SubAnnotationPropertyOf‘;
ANNOTATION_PROPERTY_DOMAIN:‘AnnotationPropertyDomain‘;
ANNOTATION_PROPERTY_RANGE:‘AnnotationPropertyRange‘;
OBJECT_INTERSECTION_OF:‘ObjectIntersectionOf‘;
OBJECT_UNION_OF:‘ObjectUnionOf‘;
OBJECT_COMPLEMENT_OF:‘ObjectComplementOf‘;
OBJECT_ONE_OF:‘ObjectOneOf‘;
OBJECT_SOME_VALUES_FROM:‘ObjectSomeValuesFrom‘;
OBJECT_ALL_VALUES_FROM:‘ObjectAllValuesFrom‘;
OBJECT_HAS_VALUE:‘ObjectHasValue‘;
OBJECT_HAS_SELF:‘ObjectHasSelf‘;
OBJECT_MIN_CARDINALITY:‘ObjectMinCardinality‘;
OBJECT_MAX_CARDINALITY:‘ObjectMaxCardinality‘;
OBJECT_EXACT_CARDINALITY:‘ObjectExactCardinality‘;
DATA_SOME_VALUES_FROM:‘DataSomeValuesFrom‘;
DATA_ALL_VALUES_FROM:‘DataAllValuesFrom‘;
DATA_HAS_VALUE:‘DataHasValue‘;
DATA_MIN_CARDINALITY:‘DataMinCardinality‘;
DATA_MAX_CARDINALITY:‘DataMaxCardinality‘;
DATA_EXACT_CARDINALITY:‘DataExactCardinality‘;
SAME_INDIVIDUAL:‘SameIndividual‘;
DIFFERENT_INDIVIDUALS:‘DifferentIndividuals‘;
CLASS_ASSERTION:‘ClassAssertion‘;
OBJECT_PROPERTY_ASSERTION:‘ObjectPropertyAssertion‘;
NEGATIVE_OBJECT_PROPERTY_ASSERTION:‘NegativeObjectPropertyAssertion‘;
DATA_PROPERTY_ASSERTION:‘DataPropertyAssertion‘;
NEGATIVE_DATA_PROPERTY_ASSERTION:‘NegativeDataPropertyAssertion‘;
DATA_INTERSECTION_OF:‘DataIntersectionOf‘;
DATA_UNION_OF:‘DataUnionOf‘;
DATA_COMPLEMENT_OF:‘DataComplementOf‘;
DATA_ONE_OF:‘DataOneOf‘;
OBJECT_INVERSE_OF:‘ObjectInverseOf‘;
DATATYPE_RESTRICTION:‘DatatypeRestriction‘;

fragment PN_CHARS_BASE : (A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z) | [\u00C0-\u00D6] | [\u00D8-\u00F6] | [\u00F8-\u02FF] | [\u0370-\u037D] | [\u037F-\u1FFF] | [\u200C-\u200D] | [\u2070-\u218F] | [\u2C00-\u2FEF] | [\u3001-\uD7FF] | [\uF900-\uFDCF] | [\uFDF0-\uFFFD];// | [\u10000-\uEFFFF] ;
fragment PN_CHARS_U : PN_CHARS_BASE | ‘_‘ ;
fragment VARNAME : ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | ‘\u00B7‘ | [\u0300-\u036F] | [\u203F-\u2040] )* ;
fragment PN_CHARS : PN_CHARS_U | ‘-‘ | [0-9] | ‘\u00B7‘ | [\u0300-\u036F] | [\u203F-\u2040] ;
fragment PN_PREFIX : PN_CHARS_BASE ((PN_CHARS|‘.‘)* PN_CHARS)? ;
fragment PN_LOCAL : (PN_CHARS_U | ‘:‘ | [0-9] | PLX ) ((PN_CHARS | ‘.‘ | ‘:‘ | PLX)* (PN_CHARS | ‘:‘ | PLX) )? ;
fragment PLX : PERCENT | PN_LOCAL_ESC ;
fragment PERCENT : ‘%‘ HEX HEX ;
fragment HEX : [0-9] | (A|B|C|D|E|F) ;
fragment PN_LOCAL_ESC : ‘\\‘ ( ‘_‘ | ‘~‘ | ‘.‘ | ‘-‘ | ‘!‘ | ‘$‘ | ‘&‘ | ‘"\‘"‘ | ‘(‘ | ‘)‘ | ‘*‘ | ‘+‘ | ‘,‘ | ‘;‘ | ‘=‘ | ‘/‘ | ‘?‘ | ‘#‘ | ‘@‘ | ‘%‘ ) ;
fragment QUOTE2:‘"‘;
fragment QUOTE1:‘\‘‘;

fragment A:[aA];
fragment B:[bB];
fragment C:[cC];
fragment D:[dD];
fragment E:[eE];
fragment F:[fF];
fragment G:[gG];
fragment H:[hH];
fragment I:[iI];
fragment J:[jJ];
fragment K:[kK];
fragment L:[lL];
fragment M:[mM];
fragment N:[nN];
fragment O:[oO];
fragment P:[pP];
fragment Q:[qQ];
fragment R:[rR];
fragment S:[sS];
fragment T:[tT];
fragment U:[uU];
fragment V:[vV];
fragment W:[wW];
fragment X:[xX];
fragment Y:[yY];
fragment Z:[zZ];
fragment UNDERLINE:‘_‘;

时间: 2024-10-15 08:37:02

用antlr文法编写的hermit swrl规则(分享)的相关文章

如何编写snort的检测规则

如何编写snort的检测规则 2013年09月08日 ⁄ 综合 ⁄ 共 16976字 前言 snort是一个强大的轻量级的网络入侵检测系统.它具有实时数据流量分析和日志IP网络数据包的能力,能够进行协议分析,对内容进行搜索/匹配.它能够检测各种不同的攻击方式,对攻击进行实时报警.此外,snort具有很好的扩展性和可移植性.本文将讲述如何开发snort规则. 1.基础 snort使用一种简单的规则描述语言,这种描述语言易于扩展,功能也比较强大.下面是一些最基本的东西: snort的每条规则必须在一

udev规则以及编写

主要内容: udev简介 如何配置和使用udev 如何编写udev规则 字符串替换和匹配 udev主要作用 编写udev规则实例 1. udev简介 1.1 什么是udev? udev是Linux(linux2.6内核之后)默认的设备管理工具.udev 以守护进程的形式运行,通过侦听内核发出来的 uevent 来管理 /dev目录下的设备文件. 如何理解udev是守护进程呢?即系统内核启动后init进程(比如busybox的init程序.sysinit.Upstart或systemd)根据run

Makefile文件编写和autotools的使用

在Linux或Unix环境下,对于只含有几个源代码文件的小程序(如hello.c)的编译,可以手工键入gcc命令对源代码文件逐个进行编译:然而在大型的项目开发中,可能涉及几十到几百个源文件,采用手工键入的方式进行编译,则非常不方便,而且一旦修改了源代码,尤其头文件发生了的修改,采用手工方式进行编译和维护的工作量相当大,而且容易出错.所以在Linux或Unix环境下,人们通常利用GNU make工具来自动完成应用程序的维护和编译工作.实际上,GNU make工具通过一个称为Makefile的文件来

ANTLR快餐教程(2) - ANTLR其实很简单

ANTLR其实很简单 ANTLR是通过递归下降的方式来解析一个语法的. 所谓的递归下降,其实很简单,不过就是一些模式匹配而己. 简单的模式匹配 我们看下官方的一个简单的例子,这是一个赋值表达式的例子. 语法这样写: assign : ID '=' expr ';' ; 解析器的代码类似于下面这样: void assign() { match(ID); match('='); expr(); match(';'); 解析只分为两种情况:第一种情况是直接模式匹配,第二种情况是调用其它函数继续分析.

编写自己的Nmap(NSE)脚本

编写自己的Nmap脚本 一.介绍 在上一篇文章Nmap脚本引擎原理中我们介绍了基本的NSE知识,这篇文章介绍如何基于Nmap框架编写简单的NSE脚本文件,下一篇文章,Nmap脚本文件分析(AMQP协议为例)会详细分析Nmap自带脚本的执行过程,以及各语句含义. 根据上一篇文章的知识,我们知道编写NSE脚本,主要是写rule函数和action,rule函数返回true时,action函数执行. 二.例子 (1)如果某个IP开放80端口则脚本扫描输出 "This IP open 80 port!&q

Ckrule业务规则管理系统简介

1.   简述 Ckrule业务规则管理系统(BRMS)是一个集成的应用程序存储.管理.执行和测试的平台,允许组织定义.部署.监控和维护运营系统使用的各种复杂决策逻辑.Ckrule BRMS 独立于核心应用程序代码提取并管理决策逻辑,以便可以跨整个组织轻松理解.维护和重用这些决策逻辑. Ckrule BRMS由下图4个部分组成: 各部分功能明细如下: 一级功能 二级功能 说明 规则存储 -- 存储库允许规则置于核心应用程序代码之外.它还允许将决策逻辑作为一项企业资产管理,从而支持更轻松地理解和更

ADFS 2.0 配置简介 PartⅢ – 声明规则语言

上一篇我们最终把 ADFS 与应用之间的信任关系建立起来了,但是应用接收到的声明信息只有默认的两个,这次我们就来学学怎么配置声明. 一.声明存储配置 ADFS 目前默认支持三种方式的声明值存储,另外还有自定义存储,不过我没去研究 二.编辑预定义声明 三.编写自己的定制声明 如果你需要编写自定义的声明规则,那么你需要掌握一种描述声明的语法,很简单的,首先让我们看看上边配置的电子邮件声明生成的语句 c:[Type == "http://schemas.microsoft.com/ws/2008/06

规则解决方案深刻地改变着业务系统的生命周期

对于经常变化,或多样性很高的业务规则,直接由程序员使用开发语言编写并不明智.如使用java,c#等语言直接表达企业的规定.制度或管理办法,甚至不定时修改的计算公式,这并非合理的做法.编程语言.数据表结构.分布式部署等因素综合之后,这些业务逻辑会变得不好维护.传统的IT专家会认为只要需求做得好,分析透彻,所有的系统需求都会被定义,可以使用一定的表结构和设计来降低或解决这些频繁的修改或多样性.但如果业务的变化范围很大,多样性是天马行空的,或当前根本没有需求,而是决策者在一定时期根据形势而作出的决策,

jboss规则引擎KIE Drools 6.3.0 Final 教程(1)

前言 目前世面上中文的KIE DROOLS Workbench(JBOSS BRMS)的教程几乎没有,有的也只有灵灵碎碎的使用机器来翻译的(翻的不知所云)或者是基于老版本的JBOSS Guvnor即5.x的一些教程,而且这些教程都是"缺胳膊少腿"的,初学者看后不知道它到底在干吗?能干吗?能够解决自己系统中什么问题. 所以笔者自己写了几个例子,把整个最新的英文版的KIE DROOLS 6.3.0.Final的官方教程给串了起来,用于供读者使用并以此来作为入门以及相关SOA理念的推广的第一