亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? strawmanparser.java

?? 好東西啊!你看看就知道了
?? JAVA
字號:
package edu.stanford.db.rdf.syntax.strawman;import org.w3c.rdf.model.*;import org.w3c.rdf.syntax.*;import org.w3c.rdf.vocabulary.rdf_syntax_19990222.RDF;import org.w3c.rdf.vocabulary.rdf_schema_19990303.RDFS;import org.w3c.rdf.util.*;import edu.stanford.db.xml.util.*;import edu.stanford.db.rdf.syntax.generic.*;import org.w3c.rdf.digest.*;import org.xml.sax.*;import org.xml.sax.helpers.*;import java.util.*;import java.io.*;import java.net.*;/** * A parser for a simplified syntax for RDF. Supports arbitrary XML files. * Uses three control attributes: * <ol> * <li><code>rdf:instance</code>: specifes that a tag denotes an instance of a class</li> * <li><code>rdf:for</code>: specifes the subject URI of the property</li> * <li><code>rdf:resource</code>: specifes the object URI of the property</li> * </ol> * * @author    Sergey Melnik <melnik@db.stanford.edu> */public class StrawmanParser extends GenericXML2RDF {  public static final String REVISION = "Strawman RDF parser v0.3 2000-10-31";  // namespace of extension attributes  public static final String _Namespace = "http://interdataworking.com/vocabulary/strawman-20000408#";  public static final QName RDF_INSTANCE = createQName(_Namespace, "instance");  public static final QName RDF_RESOURCE = createQName(_Namespace, "resource");  public static final QName RDF_FOR = createQName(_Namespace, "for");  int shift = 0;  // used to track where strawman syntax started withing XML tree  int strawDepth = 0;  // we either use digests or generate "genid"s  boolean useDigests = false;  // if we are not using digests, we need a genid counter  static int genidCounter = 0;  public StrawmanParser () {    super();  }  public StrawmanParser (boolean useDigests, boolean warn) {    super(warn);    this.useDigests = useDigests;  }  boolean isProperty(Element el) {    //    StrawElement se = (StrawElement)el;    return el.getAttribute(RDF_FOR) != null ||      (el.getParent() != null /*((StrawElement)el).depth > 0*/ && el.getAttribute(RDF_INSTANCE) == null);  }  StrawElement getParent(Element e) {    return (StrawElement)e.getParent();  }  Resource getArcFromParent(Element e) {    return ((StrawElement)e).arcFromParent;  }  int depth(Element e) {    return ((StrawElement)e).depth;  }  void collectCDATA(StrawElement p) throws ModelException {    // check for deferred CDATA    if(p.getValue().length() > 0 || (p.getType() == p.EMPTY && p.arcs.size() == 0 && p.getAttribute(RDF_RESOURCE) == null)) {      p.addArc(nodeFactory.createOrdinal(p.next()), nodeFactory.createLiteral(p.getValue()));      p.setValue(p.EMPTY_STR);    }  }  /*  Resource uri2resource(String uri) throws ModelException {    if(uri.startsWith("#"))      uri = getSourceURI() + uri;    return nodeFactory.createResource(uri);  }  */  byte[] getDigest(Object obj) throws DigestException {    if(obj instanceof Digestable)    return ((Digestable)obj).getDigest().getDigestBytes();    if(obj instanceof StrawElement) {      StrawElement se = (StrawElement)obj;      if(se.anonymous)        return se.digestPath;      else        return getDigest(se.subject);    }    throw new RuntimeException("No digest for " + obj);  }  public void startElement (String uri, String name, String qname, Attributes al) throws SAXException {        _startElement(uri, name, al);    try {      StrawElement current = (StrawElement)this.current;            // set subject if possible. If anonymous do nothing      String inst = current.getAttribute(RDF_INSTANCE);      String res = current.getAttribute(RDF_RESOURCE);      String fr = current.getAttribute(RDF_FOR);      //      System.out.println("" + inst + " " + res + " " + fr);            if(strawDepth == 0 && inst == null && res == null && fr == null)	return;      else	strawDepth++;            StrawElement parent = getParent(current);            if(inst != null && res != null)	throw new SAXException("Invalid XML element: attributes 'instance' and 'resource' are mutually exclusive!");            if(inst != null && inst.length() > 0)	current.subject = createResource(inst);      else if(res != null && res.length() > 0)	current.subject = createResource(res);      //    else if(fr != null && fr.length() > 0) // FIXME      //      current.subject = createResource(fr);      else	current.anonymous = true;            // collect non-RDF attributes      Enumeration attrs = current.getAttributes();      while(attrs.hasMoreElements()) {	QName aName = (QName)attrs.nextElement();	//      System.err.println("=== attr: " + aName);	if(!(aName.equals(RDF_RESOURCE) || aName.equals(RDF_INSTANCE) || aName.equals(RDF_FOR)))	  current.addArc(createResource(aName), nodeFactory.createLiteral(current.getAttribute(aName)));      }            if(fr != null) {	// node with rdf:for. Loose context. Set depth of this node to 0.		// create an artificial node	StrawElement el = new StrawElement();	if(parent != null)	  parent.setChild(el);	el.setChild(current);	el.setAttribute(RDF_FOR, fr);	current.setParent(el);	el.setParent(parent);		if(fr.length() > 0)	  el.subject = createResource(fr);	else	  el.anonymous = true;			//      current.setChild(el);	//      el.setParent(current);	//      current = el;		current.arcFromParent = createResource(current.getName());	el.addArc(current.arcFromParent, current);	current.depth = 1;	if(useDigests)	  current.digestPath = getDigest(current.arcFromParent);		//      el.arcFromParent = parent.next();	//      parent.addArc(el.arcFromParent, el);		//      if(res != null && res.length() > 0)	//        current.subject = createResource(res);	      } else {	// no rdf:for		if(parent != null) {	  	  collectCDATA(parent);	                                  // set path from parent to current:                                // determine whether current is property or instance element	  if(isProperty(current)) {	    current.arcFromParent = createResource(current.getName());	  } else {	    // arc from parent is next ordinal	    current.arcFromParent = nodeFactory.createOrdinal(parent.next());	  }	  parent.addArc(current.arcFromParent, current);	  	  current.depth = parent.depth + 1;	  if(useDigests) {	    // set path digest	    byte[] d = getDigest(getArcFromParent(current));          if(depth(current) == 1) {            current.digestPath = d;          } else {            //    System.err.println("--Current: " + current.getName() + ", depth=" + current.depth);            current.digestPath = new byte[parent.digestPath.length];            System.arraycopy(parent.digestPath, 0, current.digestPath, 0, parent.digestPath.length);            DigestUtil.xor(current.digestPath, d, depth(current)-1);          }	  }	}      }    } catch (Exception exc) { // ModelException or DigestException      throw new SAXException(exc);    }    //    System.out.println("Start element: " + current.getName());  }  public void endElement (String uri, String name, String qName) throws SAXException {    finishElement();    if(current.getAttribute(RDF_FOR) != null) {      // remove the artificial node      this.current = current.getParent();      finishElement();    }    if(strawDepth > 0)      strawDepth--;    _endElement(uri, name);  }  void finishElement() throws SAXException {    //      System.out.println("End element: " + current.getName());    try {            StrawElement current = (StrawElement)this.current;      boolean done = false;            collectCDATA(current);            // normalize arcs      Vector arcs = current.arcs;      // if only one arc _1 to a literal (no _2) replace it with rdf:value      StrawArc firstArc = findArc(arcs, nodeFactory.createOrdinal(1));            if(firstArc != null &&	 firstArc.object() instanceof Literal &&	 findArc(arcs, nodeFactory.createOrdinal(2)) == null) {		firstArc.predicate = RDF.value;      }            if(arcs.size() == 1) {	StrawArc singleArc = (StrawArc)arcs.elementAt(0);		if(current.anonymous && singleArc.predicate().equals(RDF.value) && isProperty(current)) {	                                  // replace this node in parent's arc list by the literal                                //      System.err.println("===REPLACING in " + current.getName());	  Vector parcs = getParent(current).arcs;	  StrawArc parc = findArc(parcs, current);	  if(parc != null) {	    //                System.err.println("===FOUND at " + i);	    // FIXME: singleArc.object must be a literal	    parc.object = singleArc.object();	    done = true;	  }	}      }            if(!done) {		if(!isProperty(current))	  current.addArc(RDF.type, createResource(current.getName()));	//        createStatement(current.subject, RDF.type, createResource(current.getName()));		if(current.anonymous) {	  if(useDigests) {	    // compute subject from digest	    for(int i=0; i < arcs.size(); i++) {	      StrawArc arc = (StrawArc)arcs.elementAt(i);	      updateDigest(current, arc);	      //  System.out.println("    node " + current.getName() + " at depth " + current.depth + " adding " + arc.predicate() + "=" + arc.object());	    }	    current.subject = createResource(getSourceURI() + "#", RDFDigestUtil.getDigestAlgorithm() +					   "-" + DigestUtil.toHexString(current.digestPath));	  } else // use genid	    current.subject = createResource(getSourceURI() + "#", "genid-" + (++genidCounter));	}		// create triple for rdf:instance	//    String inst = current.getAttribute(RDF_INSTANCE);		// generate triples for the arcs	for(int i = 0; i < arcs.size(); i++) {	  StrawArc arc = (StrawArc)arcs.elementAt(i);	  Object obj = arc.object();	  RDFNode object = obj instanceof RDFNode ? (RDFNode)obj : ((StrawElement)obj).subject;	  if(current.subject != null) // == null for the top non-RDF node containing an RDF node	    createStatement(current.subject, arc.predicate(), object);	}	// destroy arcs	current.arcs = null;      }    } catch (Exception exc) { // ModelException or DigestException      throw new SAXException(exc);    }  }  protected void updateDigest(StrawElement current, StrawArc arc) throws DigestException {    if(current.digestPath == null) // i.e. depth == 0      current.digestPath = getDigest(arc.predicate());    else      DigestUtil.xor(current.digestPath, getDigest(arc.predicate()), current.depth);    DigestUtil.xor(current.digestPath, getDigest(arc.object()), current.depth + 1);  }  protected Statement createStatement(Resource subject, Resource predicate, RDFNode object) throws ModelException {    if(!(predicate.equals(RDF.type) && object.equals(RDFS.Resource))) {      return super.createStatement(subject, predicate, object);      //      consumer.addStatement(nodeFactory.createStatement(subject, predicate, object));    }    return null;  }  StrawArc findArc(Vector arcs, Resource predicate) {    for(int i = 0; i < arcs.size(); i++) {      StrawArc arc = (StrawArc)arcs.elementAt(i);      if(arc.predicate().equals(predicate))        return arc;    }    return null;  }  StrawArc findArc(Vector arcs, StrawElement element) {    for(int i = 0; i < arcs.size(); i++) {      StrawArc arc = (StrawArc)arcs.elementAt(i);      if(arc.object() == element)        return arc;    }    return null;  }  protected Element createElement() {    return new StrawElement();  }  static void bailOut() {    System.err.println("Usage: java -Dorg.xml.sax.parser=<classname> org.w3c.rdf.syntax.strawman.StrawmanParser " +                       "[-d] <URI | filename>");    System.err.println ("This is revision " + REVISION);    System.exit(1);  }  public static void main (String args[]) throws Exception {    boolean useDigests = false;    String fileOrURI = null;    for(int i = 0; i < args.length; i++) {      String a = args[i];      if(a.startsWith("-d"))        useDigests = true;      else {        fileOrURI = a;        if(i+1 < args.length)          bailOut();      }    }    if(fileOrURI == null)      bailOut();    _main(fileOrURI, new StrawmanParser(useDigests, true));  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线免费观看视频| 蜜桃av一区二区在线观看| 91尤物视频在线观看| 中文字幕欧美一| 在线免费观看日本欧美| 亚洲国产精品尤物yw在线观看| 欧美日韩一区精品| 麻豆精品精品国产自在97香蕉 | 欧美日高清视频| 蜜臀久久99精品久久久久久9| 日韩视频一区在线观看| 国产麻豆成人传媒免费观看| 中文字幕一区视频| 欧美日韩一区二区三区在线看| 日韩成人午夜电影| 久久嫩草精品久久久久| 91美女蜜桃在线| 蜜桃免费网站一区二区三区| 亚洲国产精品t66y| 欧美色爱综合网| 国产一区二区三区日韩| 亚洲精品日日夜夜| 欧美大胆一级视频| aaa欧美大片| 热久久久久久久| 综合久久给合久久狠狠狠97色| 欧美日韩综合在线| 国产精品一区二区免费不卡| 亚洲久草在线视频| 久久一区二区三区四区| 日本精品免费观看高清观看| 美国十次综合导航| 亚洲日本va在线观看| 精品免费视频一区二区| 91在线码无精品| 国产呦精品一区二区三区网站| 一区二区国产盗摄色噜噜| www.欧美日韩国产在线| 美女视频网站黄色亚洲| 亚洲精品国产高清久久伦理二区| 精品日韩在线观看| 欧美天天综合网| 成人一级视频在线观看| 另类小说欧美激情| 亚洲国产cao| 亚洲人成网站精品片在线观看| 精品久久久久香蕉网| 欧美日韩一区三区四区| 波波电影院一区二区三区| 久久9热精品视频| 亚洲一区二区视频在线| 1024成人网| 久久精品视频一区二区| 欧美日韩不卡视频| 欧美性色aⅴ视频一区日韩精品| 国产精品自产自拍| 美女网站色91| 日韩精品视频网站| 亚洲成人精品影院| 亚洲夂夂婷婷色拍ww47| 亚洲视频精选在线| 国产日韩精品一区二区三区| 欧美第一区第二区| 日韩欧美国产高清| 日韩欧美精品在线| 欧美一区二区久久| 欧美久久久久中文字幕| 欧美三级韩国三级日本一级| 色综合天天视频在线观看| caoporm超碰国产精品| 高清不卡一区二区在线| 国产一区二区三区香蕉 | 久久精子c满五个校花| 久久久精品日韩欧美| 久久久久国产精品厨房| 久久中文字幕电影| 精品国产乱码久久久久久图片| 91精品国产免费| 欧美情侣在线播放| 欧美二区三区91| 制服丝袜中文字幕一区| 欧美电影一区二区| 日韩欧美在线一区二区三区| 欧美va日韩va| 久久综合狠狠综合久久综合88| 久久久久久久精| 国产无人区一区二区三区| 国产精品欧美久久久久一区二区 | 成人激情免费电影网址| eeuss鲁一区二区三区| 色综合夜色一区| 在线观看精品一区| 91精品一区二区三区在线观看| 欧美岛国在线观看| 国产精品系列在线| 亚洲乱码中文字幕综合| 三级欧美韩日大片在线看| 日本不卡一区二区| 国产91丝袜在线播放九色| www.99精品| 欧美日韩精品系列| 精品美女在线观看| 最新日韩av在线| 亚洲成av人片观看| 国产原创一区二区| 一本一道综合狠狠老| 欧美高清www午色夜在线视频| 精品国产乱码久久久久久影片| 欧美激情一区二区三区在线| 亚洲美女偷拍久久| 美国十次综合导航| 99久久精品免费精品国产| 欧美亚洲禁片免费| 欧美精品一区二区不卡| 亚洲欧美一区二区三区久本道91| 亚洲mv大片欧洲mv大片精品| 国产精品综合久久| 欧美丝袜第三区| 国产欧美一区二区在线| 午夜精品久久久久久久99水蜜桃 | 成人av电影在线| 91精品国产黑色紧身裤美女| 中文字幕精品一区二区三区精品| 亚洲自拍偷拍麻豆| 国产69精品久久久久毛片| 欧美精品粉嫩高潮一区二区| 国产精品无遮挡| 日本成人在线一区| 色婷婷亚洲婷婷| 国产亚洲欧美色| 免费成人美女在线观看| 色欧美日韩亚洲| 久久久久久免费| 日韩av在线免费观看不卡| 99久久婷婷国产综合精品| 久久综合999| 人人精品人人爱| 一本在线高清不卡dvd| 国产午夜精品一区二区三区嫩草| 首页亚洲欧美制服丝腿| 99精品欧美一区二区蜜桃免费| 久久综合色之久久综合| 日韩国产精品久久| 欧美综合天天夜夜久久| 国产精品美日韩| 国产成人av一区二区三区在线| 日韩天堂在线观看| 天堂一区二区在线| 在线观看国产一区二区| 亚洲女厕所小便bbb| 国产+成+人+亚洲欧洲自线| 26uuu亚洲| 精品亚洲欧美一区| 91精品视频网| 日韩va欧美va亚洲va久久| 欧美日韩小视频| 亚洲综合色噜噜狠狠| 日本道精品一区二区三区| 中文字幕一区二区三区蜜月 | 日韩欧美久久久| 日韩高清一区在线| 欧美挠脚心视频网站| 婷婷中文字幕一区三区| 欧美日韩国产综合一区二区| 亚洲一区在线播放| 91国产福利在线| 一区二区三区91| 欧美日韩综合一区| 天涯成人国产亚洲精品一区av| 欧美日韩国产综合一区二区三区| 亚洲国产你懂的| 欧美日韩国产影片| 天天色综合天天| 日韩欧美国产系列| 国产在线精品免费| 国产视频一区不卡| 成人蜜臀av电影| 亚洲女同女同女同女同女同69| 91蜜桃网址入口| 视频在线在亚洲| 欧美一区二区三区视频在线观看| 天天综合天天做天天综合| 日韩欧美高清dvd碟片| 国产一区中文字幕| 国产精品久久久久久久久免费桃花 | 欧美一区二区不卡视频| 日本三级亚洲精品| 久久久久久99精品| 色网站国产精品| 日本在线不卡一区| 日本一区二区三区免费乱视频| 成人高清免费在线播放| 亚洲一区影音先锋| 欧美哺乳videos| 成人av影视在线观看| 亚洲国产综合91精品麻豆| 欧美电影免费观看高清完整版在| 丁香五精品蜜臀久久久久99网站| 亚洲老妇xxxxxx| 欧美不卡一区二区三区四区|