SWI-Prolog

SWI Prolog

Plik XML po sparsowaniu w SWI Prologu za pomocą predykatu load_xml_file('therm.xml',X) jest w postaci listy, która składa się z zagnieżdżonych struktur typu element(Node_Name, [Value], [child_element]).

X = [element(hml, [], [
    , element(type_set, [], []), 
    , element(attribute_set, [], [
        , element(att, [name=Thermostat, id=att_0, value=single, class=ro], []), 
        , element(att, [name=Time, id=att_1, value=single, class=ro], []), 
        , element(att, [name=Temperature, id=att_2, value=single, class=ro], []), 
        , element(att, [name=Date, id=att_3, value=single, class=ro], []), 
        , element(att, [name=Hour, id=att_4, value=single, class=ro], []), 
        , element(att, [name=season, id=att_5, value=single, class=ro], []), 
        , element(att, [name=operation, id=att_6, value=single, class=ro], []), 
        , element(att, [name=thermostat_settings, id=att_7, value=single, class=ro], []), 
        , element(att, [name=day, id=att_8, value=single, class=ro], []), 
        , element(att, [name=month, id=att_9, value=single, class=ro], []), 
        , element(att, [name=today, id=att_10, value=single, class=ro], []), 
        , element(att, [name=hour, id=att_11, value=single, class=ro], []), 
    ]), 
    , element(property_set, [], [
        , element(property, [id=prp_0], [
            , element(attref, [ref=att_0], []), 
        ]), 
        , element(property, [id=prp_1], [
            , element(attref, [ref=att_1], []), 
            , element(attref, [ref=att_2], []), 
        ]), 
        , element(property, [id=prp_2], [
            , element(attref, [ref=att_1], []), 
        ]), 
        , element(property, [id=prp_3], [
            , element(attref, [ref=att_2], []), 
        ]), 
	, element(property, [id=prp_4], [
            , element(attref, [ref=att_3], []), 
            , element(attref, [ref=att_4], []), 
            , element(attref, [ref=att_5], []), 
            , element(attref, [ref=att_6], []), 
        ]), 
        , element(property, [id=prp_5], [
            , element(attref, [ref=att_3], []), 
            , element(attref, [ref=att_4], []), 
        ]), 
        , element(property, [id=prp_6], [
            , element(attref, [ref=att_5], []), 
            , element(attref, [ref=att_6], []), 
        ]), 
        , element(property, [id=prp_7], [
            , element(attref, [ref=att_7], []), 
        ]), 
        , element(property, [id=prp_8], [
            , element(attref, [ref=att_5], []), 
        ]), 
        , element(property, [id=prp_9], [
            , element(attref, [ref=att_6], []), 
        ]), 
        , element(property, [id=prp_10], [
            , element(attref, [ref=att_3], []), 
        ]), 
        , element(property, [id=prp_11], [
            , element(attref, [ref=att_4], []), 
        ]), 
        , element(property, [id=prp_12], [
            , element(attref, [ref=att_8], []), 
            , element(attref, [ref=att_9], []), 
            , element(attref, [ref=att_10], []), 
        ]), 
        , element(property, [id=prp_13], [
            , element(attref, [ref=att_9], []), 
        ]), 
	, element(property, [id=prp_14], [
            , element(attref, [ref=att_8], []), 
            , element(attref, [ref=att_10], []), 
        ]), 
        , element(property, [id=prp_15], [
            , element(attref, [ref=att_8], []), 
        ]), 
        , element(property, [id=prp_16], [
            , element(attref, [ref=att_10], []), 
        ]), 
        , element(property, [id=prp_17], [
            , element(attref, [ref=att_11], []), 
        ]), 
    ]), 
    , element(tph, [], [
        , element(trans, [src=prp_0, dst=prp_1], []), 
        , element(trans, [src=prp_1, dst=prp_2], []), 
        , element(trans, [src=prp_1, dst=prp_3], []), 
        , element(trans, [src=prp_2, dst=prp_4], []), 
        , element(trans, [src=prp_4, dst=prp_5], []), 
        , element(trans, [src=prp_4, dst=prp_6], []), 
        , element(trans, [src=prp_3, dst=prp_7], []), 
        , element(trans, [src=prp_6, dst=prp_8], []), 
        , element(trans, [src=prp_6, dst=prp_9], []), 
        , element(trans, [src=prp_5, dst=prp_10], []), 
        , element(trans, [src=prp_5, dst=prp_11], []), 
        , element(trans, [src=prp_10, dst=prp_12], []), 
        , element(trans, [src=prp_12, dst=prp_13], []), 
        , element(trans, [src=prp_12, dst=prp_14], []), 
        , element(trans, [src=prp_14, dst=prp_15], []), 
        , element(trans, [src=prp_14, dst=prp_16], []), 
        , element(trans, [src=prp_11, dst=prp_17], []), 
    ]), 
    , element(ard, [], [
        , element(dep, [independent=prp_8, dependent=prp_7], []), 
        , element(dep, [independent=prp_9, dependent=prp_7], []), 
        , element(dep, [independent=prp_13, dependent=prp_8], []), 
        , element(dep, [independent=prp_15, dependent=prp_16], []), 
        , element(dep, [independent=prp_16, dependent=prp_9], []), 
        , element(dep, [independent=prp_17, dependent=prp_9], []), 
    ]), 
])]
pl/miw/miw08_prolog_xml/varda_swi.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0