Showing posts with label faceting using booleans. Show all posts
Showing posts with label faceting using booleans. Show all posts

Friday, September 15, 2017

Custom text faceting with booleans cheat sheet



Search Criteria (up to Open Refine 2.8)
Custom text facet
Facet on strings that have both <string one> and <string two>
and (value.contains("<string one>"), value.contains("<string two>"))
Facet on strings that have either <string one> or <string two>
or (value.contains("<string one>"), value.contains("<string two>"))
Facet on strings that have <string one> and <string two> and <string three>
and(value.contains("<string one>"), value.contains("<string two>"), value.contains("<string three>"))

Note: You can chain as many value.contains() statements as you want.
Facet on strings that have <string one> or <string two> or <string three>
or(value.contains("<string one>"), value.contains("<string two>"), value.contains("<string three>"))

Note: You can chain as many value.contains() statements as you want.
Facet on strings that don’t contain <string one>
not(value.contains("<string one>")
Facet on strings that don’t contain <string one> or <string two>
not(or (value.contains("<string one>"), value.contains("<string two>")))
Facet on strings that contain (<string one> and <string two>) or <string 3>
or(and (value.contains("<string one>"), value.contains("<string two>")), value.contains("<string three>") )
regex search : Facet on strings that contain "Playstation" or "PlayStation" or "Nintendo"
or(isNotNull(value.match(/.*Play[sS]tation.*/)), value.contains("Nintendo"))

Search Criteria (Open Refine 3.0)
Custom text facet
Facet on strings that have both <string one> and <string two>
toString(and (value.contains("<string one>"), value.contains("<string two>")))
Facet on strings that have either <string one> or <string two>
toString(or (value.contains("<string one>"), value.contains("<string two>")))
Facet on strings that have <string one> and <string two> and <string three>
toString(and(value.contains("<string one>"), value.contains("<string two>"), value.contains("<string three>")))

Note: You can chain as many value.contains() statements as you want.
Facet on strings that have <string one> or <string two> or <string three>
toString(or(value.contains("<string one>"), value.contains("<string two>"), value.contains("<string three>")))

Note: You can chain as many value.contains() statements as you want.
Facet on strings that don’t contain <string one>
toString(not(value.contains("<string one>"))
Facet on strings that don’t contain <string one> or <string two>
toString(not(or (value.contains("<string one>"), value.contains("<string two>"))))
Facet on strings that contain (<string one> and <string two>) or <string 3>
toString(or(and (value.contains("<string one>"), value.contains("<string two>")), value.contains("<string three>") ))
regex search : Facet on strings that contain "Playstation" or "PlayStation" or "Nintendo"
toString(or(isNotNull(value.match(/.*Play[sS]tation.*/)), value.contains("Nintendo")))

Friday, July 28, 2017

Custom faceting using booleans



So, here's some sample data:









For the editing I want to do, I would like only the lines with v.<number>(<year>)-v<number>(<year>)

Since all of the notations vary, I tried the custom facet:
value.startsWith("v")

The problem is that lines containing data like this weren't excluded:
v.34(2008)-;v.1(1974)-v.26(2000)