-
1. Re: Full-Text Search
Matperry-Oracle Oct 21, 2015 12:48 AM (in response to 3054700)Hi,
This customization is not supported through add_datatype_index, but you can directly create a text index on MDSYS.RDF_VALUE$ and use that with orardf:textContains in SPARQL queries. That is, you do not have to go through add_datatype_index to create the index. As long as VNAME_PREFIX is included in the set of columns that are indexed, then orardf:textContains should work.
For example:
SQL> create index mdsys.rdf_v$text_idx on mdsys.rdf_value$(vname_prefix) indextype is ctxsys.context;
Index created.
SQL> select s, o
from table(sem_match(
'SELECT ?s ?o
WHERE { ?s rdfs:label ?o FILTER(orardf:textContains(?o, "New York")) }'
,sem_models('lgd_historic')
,null,null,null,null
,' '));
2 3 4 5 6 7
S
----------------------------------------------------------------------------------------------------------------------------------------------------------------
O
----------------------------------------------------------------------------------------------------------------------------------------------------------------
http://linkedgeodata.org/triplify/node358960285
25th New York Volunteer Cavelry Monument
http://linkedgeodata.org/triplify/node879249295
New York Regiment
http://linkedgeodata.org/triplify/node358239660
New York State Monument
http://linkedgeodata.org/triplify/node1251645997
New York Life Insurance Company War Memorial
http://linkedgeodata.org/triplify/node1242148250
New York Vietnam Veterans Memorial
http://linkedgeodata.org/triplify/node2971826546
Glocke aus New York
http://linkedgeodata.org/triplify/node358960283
122nd New York Volunteer Mounment
http://linkedgeodata.org/triplify/node1040277511
New York State Vietnam War Memorial
http://linkedgeodata.org/triplify/node1251645998
New York Life Insurance Company Memorial
http://linkedgeodata.org/triplify/node427545363
New York Central Roundhouse
10 rows selected.
SQL>
Hope this helps,
- Matt
-
2. Re: Full-Text Search
3054700 Oct 21, 2015 4:56 PM (in response to Matperry-Oracle)Thank you Matt it worked as suggested.
For the record, to make it work I created the lexer and the index with mdsys user. I also set the sync(on commit) parameter, I assume it is reasonable since the index created by SEM_APIS.ADD_DATATYPE_INDEX is created that way (impact on performance will be tested later though).
SQLPLUS 'mdsys/<MDSYS_PASSWORD>'
SQL> BEGIN
CTX_DDL.create_preference('ai_lexer', 'BASIC_LEXER');
CTX_DDL.set_attribute('ai_lexer', 'BASE_LETTER', 'true');
CTX_DDL.set_attribute('ai_lexer', 'OVERRIDE_BASE_LETTER', 'true');
END;
SQL> CREATE INDEX MDSYS.RDF_V$TEXT_IDX ON MDSYS.RDF_VALUE$(VNAME_PREFIX)
indextype is ctxsys.context
parameters ('lexer AI_LEXER sync (on commit)');