Exporting rich text definitions

203 views
Skip to first unread message

Kevin Guest

unread,
Mar 2, 2021, 2:33:49 PM3/2/21
to topbrai...@googlegroups.com
Hello,

In one of our glossaries we use rich text format to populate definition fields.  Sometimes I need to export a set of definitions, but when I export to Excel or CSV the markup is included.  Is there a way to export to Excel with just the text?  Some definitions are written in paragraphs, have lists of values, some hyperlinks, bold text, etc., but I don't need any of that -- just the text definitions.

I haven't used SPARQL to do querying or other functions but I am open to learning if that's the solution.

Thanks,
Kevin

Irene Polikoff

unread,
Mar 2, 2021, 9:33:51 PM3/2/21
to topbrai...@googlegroups.com
Kevin,

You can try the following SPARQL query

SELECT ?term ?def
WHERE {?term skos:definition ?d
BIND (ui:convertHTMLToText(?d) AS ?def)   
}

Make sure to define the prefix for ui:


Expand the area where prefixes are defined and start typing PREFIX then space - you will get a list of known prefixes/namespaces to choose from.

Then, you could export results in TSV or XML.

This conversion function is not perfect. It will remove bold text, bullets, images, paragraph, but the hyperlink values will remain there. There could also be some issues with the new lines in the TSV export.

If we have time, we will see if we can improve it for 7.0.

Regards,

Irene Polikoff
--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAPQ9gY9vCq_BU1nZ7HJLzwzW%3Dh7dpHtYDADgJBPw32jXWO7TmQ%40mail.gmail.com.

Kevin Guest

unread,
Mar 3, 2021, 12:42:11 PM3/3/21
to topbrai...@googlegroups.com
Hi Irene,
I appreciate your taking the time to reply.
I'll see if I can apply your suggestions.
--Kevin

Jan Campschroer

unread,
Jan 24, 2024, 9:15:30 AMJan 24
to TopBraid Suite Users
Hello, i've got a related question. In the Excel-export from te Form-panel there is stille some html-code (like <strong>xx</strong>  and &euml instead of  xx and ë) is visible. Is there a WYSIWG Export to Excel? 
The function ui:convertHTMLToText has the same output.

Regards, Jan

Op woensdag 3 maart 2021 om 18:42:11 UTC+1 schreef Kevin Guest:

Holger Knublauch

unread,
Jan 25, 2024, 4:16:51 AMJan 25
to topbrai...@googlegroups.com
Hi Jan,

would you be able to clarify what feature you are referring to? I don't think the Form panel has Excel export. Do you mean export from the results of the SPARQL Query panel? That does not have Excel export, although it has tab-separated values export.

To make this precise I ran this query:

SELECT *
WHERE {
BIND ("&Auml;ldi"^^rdf:HTML AS ?shop) .
BIND (<http://uispin.org/ui#convertHTMLToText>(?shop) AS ?text) .
}

and exported it to TSV, producing

?shop ?text

which at least indicates that convertHTMLToText has different output. But it produces verbatim rendering of the first column, which looks reasonable.

Thanks
Holger


--
The topics of this mailing list include TopBraid EDG and related technologies such as SHACL.
To post to this group, send email to topbrai...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.

Jan Campschroer

unread,
Jan 25, 2024, 5:19:52 AMJan 25
to TopBraid Suite Users
Edg export excel.PNG

Op donderdag 25 januari 2024 om 10:16:51 UTC+1 schreef Holger Knublauch:

Holger Knublauch

unread,
Jan 25, 2024, 6:25:38 AMJan 25
to 'Bohms, H.M. (Michel)' via TopBraid Suite Users
Thanks for clarifying it's the Search panel.

Yes I see what you mean. Examples such as

PastedGraphic-1.png

do render OK in the UI (when the sh:datatype includes rdf:HTML) yet the Excel export produces the verbatim literal.

I have recorded an enhancement request but cannot promise a fix date as we have plenty of tickets on our plates right now.

Also, maybe some users prefer having the original HTML here, so this would need to become an option.


Meanwhile, if you really need plain values, you could declare another property that is backed by a sh:values rule which calls ui:convertHTMLToText and produces a plain string. See


or feel free to ask again if you want to go down this route and don't know how. We also have professional services or premium support for such help cases.

Holger



Jan Campschroer

unread,
Jan 25, 2024, 6:39:20 AMJan 25
to TopBraid Suite Users
Hello Holger,Edg export excel 2.PNG
your right, the diacrits are handeld well.
This the source, the result using HTMLLtoText en the desired output


Op donderdag 25 januari 2024 om 11:19:52 UTC+1 schreef Jan Campschroer:

Holger Knublauch

unread,
Jan 25, 2024, 6:43:54 AMJan 25
to 'Bohms, H.M. (Michel)' via TopBraid Suite Users
Ok, including the formatting such as the bold font is yet another requirement. I have added this to our ticket but I am not familiar with the code to see if that's realistic/easy with our Excel formatter.

Holger


On 25 Jan 2024, at 12:39 pm, Jan Campschroer <camps...@planet.nl> wrote:

Hello Holger,<Edg export excel 2.PNG>

Jan Campschroer

unread,
Jan 25, 2024, 6:44:21 AMJan 25
to TopBraid Suite Users
Hi Holger,

thank you for your actions. It's also good to know that ther isn't (yet) a solution to the problem.

Regards, Jan

Op donderdag 25 januari 2024 om 12:39:20 UTC+1 schreef Jan Campschroer:
Reply all
Reply to author
Forward
0 new messages