Add new row to record

42 views
Skip to first unread message

Robert Garrigos

unread,
Oct 19, 2022, 2:22:45 AM10/19/22
to openr...@googlegroups.com
Hi everyone,

I’m new to Openrefine and have a problem I don’t know how to solve:

I’m using openrefine to edit items on wikidata. I have a first list of
items, which I reconcile against WD, then add a new column, with the
values of "instance of”, from reconciled values. This leaves me with
some items with one value and some other with two on that new column.

How can I add a second value for "instance of" for the records with only
one value?

Thanks!
--
========================
Robert Garrigós i Castro
https://garrigos.cat
+34 620 91 87 01

Owen Stephens

unread,
Oct 21, 2022, 4:48:17 AM10/21/22
to OpenRefine
Hi

I'm not sure I've totally understood what you are trying to achieve, but I would suggest something like:

1. Isolate all records/rows that are missing the "instance of" statement you want to see (you could do this via a facet)
2. Add a new column containing the Wikidata name or ID for the instance of statement you want to add (e.g. human or Q5 if you want to assert "instance of human")
3. Reconcile this column (if you have populated with wikidata IDs you can use the option to "Use values as identifiers" to make this very easy)
4. Create a wikidata schema that uses your original entities and adds a P31 / instance of statement using your new column

I've just put the basic steps here so if any of this is unfamiliar please ask about the specific steps you need help with and I will try to expand on my answer

Best wishes

Owen

Robert Garrigos

unread,
Oct 21, 2022, 5:03:37 AM10/21/22
to openr...@googlegroups.com
Thanks Owen,

I know what is happening: whenever you change a reconciled value within
openrefine it actually adds it to the wikidata item during wikidata
upload. I assumed it would change it, rather than add it.

Now the problem is another: if I wanted to change a value in wikidata,
rather than add a new one, how is it done? Can I change it or do I have
to add the new value, as I just relalized, and then delete the old one?
How is it done, then, deleting a reconciled value and upload that
deletion to wikidata?

I realize that these are basic questions, but I don't see an explanation
on the help documentation or I'm missing something.

Thanks.

========================
Robert Garrigós i Castro
https://garrigos.cat
+34 620 91 87 01

El 21/10/22 a les 10:48, Owen Stephens ha escrit:
> https://garrigos.cat <https://garrigos.cat>
> +34 620 91 87 01 <tel:+34%20620%2091%2087%2001>
>
> --
> You received this message because you are subscribed to the Google
> Groups "OpenRefine" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to openrefine+...@googlegroups.com
> <mailto:openrefine+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/openrefine/92b913ba-038b-4fec-9b1b-bd8aad69fe1bn%40googlegroups.com <https://groups.google.com/d/msgid/openrefine/92b913ba-038b-4fec-9b1b-bd8aad69fe1bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Owen Stephens

unread,
Oct 21, 2022, 5:26:30 AM10/21/22
to OpenRefine
On Friday, October 21, 2022 at 10:03:37 AM UTC+1 rob...@garrigos.cat wrote:
Now the problem is another: if I wanted to change a value in wikidata,
rather than add a new one, how is it done? Can I change it or do I have
to add the new value, as I just relalized, and then delete the old one?
How is it done, then, deleting a reconciled value and upload that
deletion to wikidata?

In the Wikidata schema editor for each property you add to the schema there is a "Confgure" option which allows you to specify "Editing mode" for the property between:
* Add or merge
* Add
* Delete

And additionally you can set the "Matching strategy"
* Property, value and qualifiers
* Property and value
* Property only

If I was wanting to replace an existing P31 with a different P31 then I'd suggest that the safest approach would be:
1. Remove the existing one by getting the existing P31 value and then using Editing mode = Delete and Matching Strategy = Property and value
2. Add your new one by setting the new P31 with "Add or merge" and "Property and value" (these are the default values when you add a new property to the schema)

This way you would be very precise in what you were removing and adding. This is much more advisable than using "Add or merge" with "Property only" because items can have multiple P31 and you'd be relying on it replacing the one you wanted (which would just depend on it being the first value found in the existing record) with the new one - so you could easily end up making unintended changes

I realize that these are basic questions, but I don't see an explanation
on the help documentation or I'm missing something.
I don't think these are basic questions! 

I've done a lot of editing of Wikidata with OpenRefine in the past (although not so much recently), but I still have to remind myself every time I look at it how it actually works!

Owen

Owen Stephens

unread,
Oct 21, 2022, 5:28:19 AM10/21/22
to OpenRefine
Oh .. and just for further clarification - if you were wanting (for instance) to replace an existing statement with an updated statement which was the same value but with new/updated qualifiers - then the "Add or merge" strategy with "Property and value" is likely to be more appropriate

Robert Garrigos

unread,
Oct 21, 2022, 5:31:29 AM10/21/22
to openr...@googlegroups.com
Thanks, Owen, that was a really helpful answer!!

========================
Robert Garrigós i Castro
https://garrigos.cat
+34 620 91 87 01

El 21/10/22 a les 11:28, Owen Stephens ha escrit:
> --
> You received this message because you are subscribed to the Google
> Groups "OpenRefine" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to openrefine+...@googlegroups.com
> <mailto:openrefine+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/openrefine/b36112cd-0582-4532-8031-4d9c4633f0a6n%40googlegroups.com <https://groups.google.com/d/msgid/openrefine/b36112cd-0582-4532-8031-4d9c4633f0a6n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Williams,HK

unread,
Oct 21, 2022, 10:14:21 AM10/21/22
to openr...@googlegroups.com

Hi Owen,

I wasn’t aware of all these options, so this is useful for me too, thank you. 

I can’t see the configure option though – could you share a screenshot? 

This is what I’m seeing on a schema of mine

 

Thanks

Helen

--

You received this message because you are subscribed to the Google Groups "OpenRefine" group.

To unsubscribe from this group and stop receiving emails from it, send an email to openrefine+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openrefine/b36112cd-0582-4532-8031-4d9c4633f0a6n%40googlegroups.com.

Owen Stephens

unread,
Oct 21, 2022, 10:21:07 AM10/21/22
to OpenRefine
Hi Helen

I'd expect it to be on the righthand side with the 'remove', 'add qualifier' etc etc. options. 
This is a relatively recent addition (not sure which version - sorry) so if you are running an older version you might need to update to see it

Owen

Williams,HK

unread,
Oct 21, 2022, 10:22:34 AM10/21/22
to openr...@googlegroups.com

Ah, I should have thought of that myself, thanks Owen.  I realise I’m on 3.5.1!

Will update and try again

Robert Garrigos

unread,
Oct 21, 2022, 12:07:30 PM10/21/22
to openr...@googlegroups.com
Hi Helen,

I'm on last version 3.6.2 and there is a configure option.

Cheers.

========================
Robert Garrigós i Castro
https://garrigos.cat
+34 620 91 87 01

El 21/10/22 a les 16:22, Williams,HK ha escrit:
> Ah, I should have thought of that myself, thanks Owen.  I realise I’m on
> 3.5.1!
>
> Will update and try again
>
> Thanks
>
> Helen
>
> *From:*openr...@googlegroups.com <openr...@googlegroups.com> *On
> Behalf Of *Owen Stephens
> *Sent:* 21 October 2022 15:21
> *To:* OpenRefine <openr...@googlegroups.com>
> *Subject:* Re: [OpenRefine] Re: Add new row to record
>
> Hi Helen
>
> I'd expect it to be on the righthand side with the 'remove', 'add
> qualifier' etc etc. options.
>
> This is a relatively recent addition (not sure which version - sorry) so
> if you are running an older version you might need to update to see it
>
> Owen
>
> On Friday, October 21, 2022 at 3:14:21 PM UTC+1 Williams,HK wrote:
>
> Hi Owen,
>
> I wasn’t aware of all these options, so this is useful for me too,
> thank you.
>
> I can’t see the configure option though – could you share a screenshot?
>
> This is what I’m seeing on a schema of mine
>
> Thanks
>
> Helen
>
> *From:*openr...@googlegroups.com <openr...@googlegroups.com> *On
> Behalf Of *Owen Stephens
> *Sent:* 21 October 2022 10:28
> *To:* OpenRefine <openr...@googlegroups.com>
> *Subject:* Re: [OpenRefine] Re: Add new row to record
> https://groups.google.com/d/msgid/openrefine/b36112cd-0582-4532-8031-4d9c4633f0a6n%40googlegroups.com <https://groups.google.com/d/msgid/openrefine/b36112cd-0582-4532-8031-4d9c4633f0a6n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "OpenRefine" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to openrefine+...@googlegroups.com
> <mailto:openrefine+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/openrefine/174fd10e-c57c-4401-9371-a85bd902313fn%40googlegroups.com <https://groups.google.com/d/msgid/openrefine/174fd10e-c57c-4401-9371-a85bd902313fn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "OpenRefine" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to openrefine+...@googlegroups.com
> <mailto:openrefine+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/openrefine/DB8P191MB07640F01034D44DB6CC029AF972D9%40DB8P191MB0764.EURP191.PROD.OUTLOOK.COM <https://groups.google.com/d/msgid/openrefine/DB8P191MB07640F01034D44DB6CC029AF972D9%40DB8P191MB0764.EURP191.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.
query_lied__csv_-_OpenRefine.pdf

Williams,HK

unread,
Oct 24, 2022, 6:50:17 AM10/24/22
to openr...@googlegroups.com
Thanks Owen and Robert,

I've upgraded to the latest version and can now see these options - thank you.

What I'd been wondering is whether it would offer the option to bulk edit reference URLs on statements... so the statements themselves would stay the same, but just the reference URL would change. An alternative would be, wherever this reference URL appears (which could be on multiple statements) change it to this different URL.
It doesn't look as if that's possible. Are you aware of whether that might be a possibility in a future release?

Thanks
Helen
To view this discussion on the web visit https://groups.google.com/d/msgid/openrefine/7c7bd8a2-e5c4-b0f7-be94-7adbd92992dc%40garrigos.cat.

Owen Stephens

unread,
Oct 24, 2022, 7:32:40 AM10/24/22
to OpenRefine
Hi Helen

I'm not 100% sure but I would have thought that this could be achieved by setting to match on "Property and value" and using "Add or merge"
Does this work?

Owen

Williams,HK

unread,
Oct 24, 2022, 9:32:31 AM10/24/22
to openr...@googlegroups.com

Thanks Owen,

I had a go, but Wikidata then ends up with 2 references – both the old one and the new one.

I had been wondering if this would  be a method to edit reference URLs following a system change – not happening yet, but I’m thinking ahead to a possible scenario, so when this cropped up I just wondered if it might be a potential solution.

Thanks

Helen

Reply all
Reply to author
Forward
0 new messages