bupaverse / petrinetR

4 stars 0 forks source link

Error reading in pnml file with petrinetR::read_pnml #7

Closed rensl88 closed 1 year ago

rensl88 commented 3 years ago

@gertjanssenswillen Due to various reasons I can't use the graphical toolset of pm4py to visualize my petrinet. Therefore as alternative, I tried petrinetR to read and render the pnml file I exported with pm4py.

I tried loading the file with read_PN as follows:

> pn_file_name <- "PetriNet_simult.pnml"
> pn <- read_PN(paste0(output_dir, pn_file_name))

However, this resulted in the following error:

x Column `node` is a `xml_nodeset` object.
Run `rlang::last_error()` to see where the error occurred.

> rlang::last_error()
<error/tibble_error_column_scalar_type>
All columns in a tibble must be vectors.
x Column `node` is a `xml_nodeset` object.
Backtrace:
 1. petrinetR::read_PN(paste0(output_dir, pn_dir))
 5. tibble::data_frame(node = t)
 6. tibble::tibble(!!!quos(...))
 7. tibble:::tibble_quos(xs[!is.null], .rows, .name_repair)
 8. tibble:::check_valid_col(res, col_names[[j]], j)
 9. tibble:::check_valid_cols(set_names(list(x), name))
Run `rlang::last_trace()` to see the full context.

> rlang::last_trace()
<error/tibble_error_column_scalar_type>
All columns in a tibble must be vectors.
x Column `node` is a `xml_nodeset` object.
Backtrace:
    x
 1. \-petrinetR::read_PN(paste0(output_dir, pn_dir))
 2.   +-`%>%`(...)
 3.   | \-base::eval(lhs, parent, parent)
 4.   |   \-base::eval(lhs, parent, parent)
 5.   \-tibble::data_frame(node = t)
 6.     \-tibble::tibble(!!!quos(...))
 7.       \-tibble:::tibble_quos(xs[!is.null], .rows, .name_repair)
 8.         \-tibble:::check_valid_col(res, col_names[[j]], j)
 9.           \-tibble:::check_valid_cols(set_names(list(x), name))

I know it would be much easier to try to visualize the net directly in R with bupaR, however I turned to pm4py to try the inductive miner alternative algorithms which aren't installed in the R pm4py package or bupaR.

Any help is appreciated!

rensl88 commented 3 years ago

Closing this topic, got it to work by installing an older Tibble version, 2.1.3. instead of 3.0.3.

gertjanssenswillen commented 3 years ago

Thanks for noticing. i'll reopen it order to get it fixed for latest tibble version.