var Locator = new ActiveXObject("WbemScripting.SWbemLocator"); var Service = Locator.ConnectServer(); Service.Security_.ImpersonationLevel=3; function getClassesForPred(pred) { var rs = (select ?c using #SCHEMA where {[rdfs:domain] #pred ?c} and {[cim:visibility] ?c #VIS_DYNAMIC}); return rs; } function getClassFromUri(_uri, bAll) { var res = (new regexp(".*/([^/\\?]*)")).exec(_uri); if (res != null) { var resClass = resource((new regexp("([^?]*)")).exec(_uri)[1]); if (bAll != true) { var rs = (select ?c using #SCHEMA where {[cim:visibility] #resClass #VIS_DYNAMIC}); if (rs.EOF) return null; } return res[1]; } return null; } function getClassFromObject(Obj) { return resource("cim:" + Obj.Path_.Class); } function getIdFromUri(_uri) { var res = (new regexp(".*\\?id=(.*)")).exec(_uri); if (res != null) return urldecode(res[1]); return null; } function makeObjectUri(o) { var strClass = o.Path_.Class; return resource(BASE + strClass + "?id=" + server.urlEncode(string(o.Path_.Relpath).substring(strClass.length))); } function dumpObject(Obj, resObj, ds, p, o) { var resCls = getClassFromObject(Obj); if (p == null || p == resource("rdf:type")) { if (o == null || o == resCls) (insert {[rdf:type] #resObj #resCls} into #ds); } if (p == null || p == resource("rdfs:label")) { if (o == null || o == Obj.Path_.RelPath) (insert {[rdfs:label] #resObj #(Obj.Path_.RelPath)} into #ds); } if (p != null) { var strProp = string(p).substring(string(resCls).length + 1); var Prop = Obj.Properties_.item(strProp); if (Prop != null) dumpPropVal(p, resObj, Prop, ds, o); } else { for (var Iter = new Enumerator(Obj.Properties_); !Iter.atEnd(); Iter.moveNext()) { var resProp = Resource(resCls + "_" + Iter.item().Name); if (p != null && resProp != p) continue; dumpPropVal(resProp, resObj, Iter.item(), ds, o); } } } function dumpPropVal(resProp, resObj, Prop, ds, o) { try { if (Prop.Value != null) { var cimtype = Prop.CIMType; var val; if (cimtype == 102) { val = makeObjectUri(Service.Get(Prop.Value)); } else { val = string(Prop.Value); val.datatype = getXSDType(Prop.CIMType); } if (o == null || o == val) (insert {#resProp #resObj #val} into #ds); } } catch(e) { } } function getXSDType(cimtype) { switch(cimtype) { case 8: return resource("xsd:string"); case 101: return resource("xsd:dateTime"); case 19: return resource("xsd:unsignedInt"); case 17: return resource("xsd:unsignedByte"); case 16: return resource("xsd:byte"); case 18: return resource("xsd:unsignedShort"); case 11: return resource("xsd:boolean"); case 21: return resource("xsd:unsignedLong"); case 4: return resource("xsd:float"); case 2: return resource("xsd:short"); case 5: return resource("xsd:double"); case 3: return resource("xsd:integer"); case 20: return resource("xsd:long"); } }