Field Predicate Map

From n² wiki

Jump to: navigation, search

Nearby: Platform Resource Types, Platform API

A Field Predicate Map is a list of RDF property URIs and short names that they map to. When a user performs a query on a store's Contentbox the Field/Predicate map is used to convert the short names used in the query into the property URIs that are being searched.

In this example the property URI http://xmlns.com/foaf/0.1/name is mapped to "name" and the URI http://xmlns.com/foaf/0.1/nick is mapped to "nick":

<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:bf="http://schemas.talis.com/2006/bigfoot/configuration#" xmlns:frm="http://schemas.talis.com/2006/frame/schema#" >
  <bf:FieldPredicateMap rdf:about="http://api.talis.com/stores/mystore/indexes/default/fpmaps/default">
    <frm:mappedDatatypeProperty>
      <rdf:Description rdf:about="http://api.talis.com/stores/mystore/indexes/default/fpmaps/default#name">
        <frm:property rdf:resource="http://xmlns.com/foaf/0.1/name"/>
        <frm:name>name</frm:name>
      </rdf:Description>
    </frm:mappedDatatypeProperty>
    <frm:mappedDatatypeProperty>
      <rdf:Description rdf:about="http://api.talis.com/stores/mystore/indexes/default/fpmaps/default#nick">
        <frm:property rdf:resource="http://xmlns.com/foaf/0.1/nick"/>
        <frm:name>nick</frm:name>
      </rdf:Description>
    </frm:mappedDatatypeProperty>
  </bf:FieldPredicateMap>
</rdf:RDF>

Note that at present, only properties listed in a store's Field/Predicate map are indexed for searching via the Contentbox and that only literal values are indexed.


Resource Operations

Method Semantics Capability required
GET Retrieve a representation of the fp map basic-search
PUT Update a representation of the fp map configure-store
DELETE Not allowed
POST Not allowed

The representation consists of the Hierarchical CBD for that resource


As described in Output Types representations of this resource can be obtained by specifying appropriate media types in the accept header of the request or by supplying an output parameter with an appropriate value in the URI's query string. This resource supports at least the following outputs:

  • html
  • rdf

Analyzers

Mappings in a field/predicate map can be assigned a language analyzer using the http://schemas.talis.com/2006/bigfoot/configuration#analyzer property which determines how the value of the predicate is to be indexed.

For example, in this mapping, the foaf:name predicate is assigned a normalised english analyzer:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:bf="http://schemas.talis.com/2006/bigfoot/configuration#" xmlns:frm="http://schemas.talis.com/2006/frame/schema#" >
  <bf:FieldPredicateMap rdf:about="http://api.talis.com/stores/mystore/indexes/default/fpmaps/default">
    <frm:mappedDatatypeProperty>
      <rdf:Description rdf:about="http://api.talis.com/stores/mystore/indexes/default/fpmaps/default#name">
        <frm:property rdf:resource="http://xmlns.com/foaf/0.1/name"/>
        <frm:name>name</frm:name>
        <bf:analyzer rdf:resource="http://schemas.talis.com/2007/bigfoot/analyzers#norm-en" />
      </rdf:Description>
    </frm:mappedDatatypeProperty>
  </bf:FieldPredicateMap>

The following analyzers are supported:

English Standard

URI: http://schemas.talis.com/2007/bigfoot/analyzers#standard-en

A standard English analyzer and the default if no analyzer is specified. Words are split on punctuation characters, removing the punctuation. Words containing a dot are not split. Words containing both hyphens and numbers are not split. Email addresses and hostnames are not split. Stop words are removed. Searches on fields with this type of analyzer are case insensitive.

The following words are considered to be stop words and will not be indexed: a, an, and, are, as, at, be, but, by, for, if, in, into, is, it, no, not, of, on, or, such, that, the, their, then, there, these, they, this, to, was, will, with

English No-Stop

URI: http://schemas.talis.com/2007/bigfoot/analyzers#nostop-en

English analyzer without stop words. This is identical to the standard English analyzer but all words are indexed.

English Normalised

URI: http://schemas.talis.com/2007/bigfoot/analyzers#norm-en

English analyzer without stop words and with accent support. This is identical to the standard English analyzer but all words are indexed plus any accented characters in the ISO Latin 1 character set are replaced by their unaccented equivalent. The following table shows the replacements made:

Accented characters Unaccented characters
à á â ã ä å a
À Á Â Ã Ä Å A
æ ae
Æ AE
ç c
Ç C
ð d
Ð D
è é ê ë e
È É Ê Ë E
ì í î ï i
Ì Í Î Ï I
ñ n
Ñ N
ò ó ô õ ö ø o
Ò Ó Ô Õ Ö Ø O
œ oe
Œ OE
ß ss
þ th
Þ TH
ù ú û ü u
Ù Ú Û Ü U
ý ÿ y
Ý Ÿ Y

Keywords

URI: http://schemas.talis.com/2007/bigfoot/analyzers#keyword

This analyzer does not split the field at all. The entire value of the field is indexed as a single token.

Dutch Standard

URI: http://schemas.talis.com/2007/bigfoot/analyzers#standard-nl

A standard Dutch language analyzer. Words are split on punctuation characters, removing the punctuation. Words containing a dot are not split. Words containing both hyphens and numbers are not split. Email addresses and hostnames are not split. Stop words are removed. Searches on fields with this type of analyzer are case sensitive.

The following words are considered to be stop words and will not be indexed: de, en, van, ik, te, dat, die, in, een, hij, het, niet, zijn, is, was, op, aan, met, als, voor, had, er, maar, om, hem, dan, zou, of, wat, mijn, men, dit, zo, door, over, ze, zich, bij, ook, tot, je, mij, uit, der, daar, haar, naar, heb, hoe, heeft, hebben, deze, u, want, nog, zal, me, zij, nu, ge, geen, omdat, iets, worden, toch, al, waren, veel, meer, doen, toen, moet, ben, zonder, kan, hun, dus, alles, onder, ja, eens, hier, wie, werd, altijd, doch, wordt, wezen, kunnen, ons, zelf, tegen, na, reeds, wil, kon, niets, uw, iemand, geweest, andere

German Standard

URI: http://schemas.talis.com/2007/bigfoot/analyzers#standard-de

A standard German language analyzer. Words are split on punctuation characters, removing the punctuation. Words containing a dot are not split. Words containing both hyphens and numbers are not split. Email addresses and hostnames are not split. Stop words are removed and any remaining words are stemmed. Searches on fields with this type of analyzer are case insensitive.

The following words are considered to be stop words and will not be indexed: einer, eine, eines, einem, einen, der, die, das, dass, daß, du, er, sie, es, was, wer, wie, wir, und, oder, ohne, mit, am, im, in, aus, auf, ist, sein, war, wird, ihr, ihre, ihres, als, für, von, mit, dich, dir, mich, mir, mein, sein, kein, durch, wegen, wird

French Standard

URI: http://schemas.talis.com/2007/bigfoot/analyzers#standard-fr

A standard French language analyzer. Words are split on punctuation characters, removing the punctuation. Words containing a dot are not split. Words containing both hyphens and numbers are not split. Email addresses and hostnames are not split. Stop words are removed and any remaining words are stemmed. Searches on fields with this type of analyzer are case insensitive.

The following words are considered to be stop words and will not be indexed: a, afin, ai, ainsi, après, attendu, au, aujourd, auquel, aussi, autre, autres, aux, auxquelles, auxquels, avait, avant, avec, avoir, c, car, ce, ceci, cela, celle, celles, celui, cependant, certain, certaine, certaines, certains, ces, cet, cette, ceux, chez, ci, combien, comme, comment, concernant, contre, d, dans, de, debout, dedans, dehors, delà, depuis, derrière, des, désormais, desquelles, desquels, dessous, dessus, devant, devers, devra, divers, diverse, diverses, doit, donc, dont, du, duquel, durant, dès, elle, elles, en, entre, environ, est, et, etc, etre, eu, eux, excepté, hormis, hors, hélas, hui, il, ils, j, je, jusqu, jusque, l, la, laquelle, le, lequel, les, lesquelles, lesquels, leur, leurs, lorsque, lui, là, ma, mais, malgré, me, merci, mes, mien, mienne, miennes, miens, moi, moins, mon, moyennant, même, mêmes, n, ne, ni, non, nos, notre, nous, néanmoins, nôtre, nôtres, on, ont, ou, outre, où, par, parmi, partant, pas, passé, pendant, plein, plus, plusieurs, pour, pourquoi, proche, près, puisque, qu, quand, que, quel, quelle, quelles, quels, qui, quoi, quoique, revoici, revoilà, s, sa, sans, sauf, se, selon, seront, ses, si, sien, sienne, siennes, siens, sinon, soi, soit, son, sont, sous, suivant, sur, ta, te, tes, tien, tienne, tiennes, tiens, toi, ton, tous, tout, toute, toutes, tu, un, une, va, vers, voici, voilà, vos, votre, vous, vu, vôtre, vôtres, y, à, ça, ès, été, être, ô.

Greek Standard

URI: http://schemas.talis.com/2007/bigfoot/analyzers#standard-el

A standard French language analyzer. Words are split on punctuation characters, removing the punctuation. Words containing a dot are not split. Words containing both hyphens and numbers are not split. Email addresses and hostnames are not split. Stop words are removed. Searches on fields with this type of analyzer are case insensitive.

Chinese + Japanese + Korean Standard

URI: http://schemas.talis.com/2007/bigfoot/analyzers#standard-cjk

A standard CJK language analyzer.


Validation of Field/Predicate Maps

When a Field/Predicate map is submitted to a store it must conform to certain constraints. The store uses the following Sparql queries to check whether the map conforms. If any clause returns TRUE then the map will be rejected. In the example shown the URI of the Field/Predicate Map is http://api.talis.com/stores/mystore/indexes/default/fpmaps/default

These Sparql queries corresponds to the following checks. The update will fail if the submitted map...

  1. ... contains a frm:mappedDatatypeProperty predicate that has a URI for its value that is not prefixed with map's URI plus a # character or
  2. ... contains a frm:mappedDatatypeProperty predicate with a literal or blank value
  3. ... contains a frm:mappedDatatypeProperty predicate whose value has a frm:name predicate that doesn't conform to the regex ^[a-zA-Z][a-zA-Z0-9]*$
  4. ... contains a frm:mappedDatatypeProperty predicate whose value has a frm:name predicate that isn't a literal
  5. ... contains a frm:mappedDatatypeProperty predicate whose value has a frm:property predicate that isn't a URI
  6. ... contains triples with a subject other than the map that is not the object of another triple
  7. ... contains triples but does not contain one that has the map as its subject


ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?mdp frm:name ?name1 . 
    OPTIONAL { ?mdp frm:property ?prop1 . } 
    FILTER (! BOUND(?prop1)) . 
}

Failing this sparql query results in the error message: "One of the mappings in the supplied description does not contain a mapped property."

  
ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?mdp frm:property ?prop1 . 
    OPTIONAL { ?mdp frm:name ?name1 . } 
    FILTER (! BOUND(?name1)) . 
}

Failing this sparql query results in the error message: "One of the mappings in the supplied description does not contain a mapped name."

  
ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?mdp frm:name ?name1 . 
    ?mdp frm:name ?name2 . 
    FILTER (?name1 != ?name2) . 
}

Failing this sparql query results in the error message: "One of the mappings in the supplied description contains more than one mapped name."

  
ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?mdp frm:property ?prop1 . 
    ?mdp frm:property ?prop2 . 
    FILTER (?prop1 != ?prop2) . 
}

Failing this sparql query results in the error message: "One of the mappings in the supplied description contains more than one mapped property."

  
ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?mdp ?anyproperty ?anyvalue . 
    FILTER isIRI(?mdp) 
    FILTER BOUND(?anyvalue)
    FILTER (!REGEX(STR(?mdp), '^%1$s#')) . 
}

Failing this sparql query results in the error message: "The supplied description contains a property whose uri is not prefixed with the map's uri plus a # character.

  
ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    FILTER (! ISIRI(?mdp)) . 
}

Failing this sparql query results in the error message: "The supplied description contains mappings which are not uri's."

ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?mdp frm:name ?mpname .
    {
      FILTER ISLITERAL(?mpname)
      FILTER (!REGEX(?mpname, '^[a-zA-Z][a-zA-Z0-9]*$'))
    }
}

Failing this sparql query results in the error message: "The supplied description contains a property with a name which does not conform to the regex ^[a-zA-Z][a-zA-Z0-9]*$."

ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?mdp frm:name ?mpname .
    {
      FILTER (! ISLITERAL(?mpname) )
    }
}

Failing this sparql query results in the error message: "The supplied description contains a name which is not a literal."

ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?mdp frm:property ?mpproperty .
    FILTER (! ISIRI(?mpproperty) )
}

Failing this sparql query results in the error message: "The supplied description contains mappings with a property that isn't a URI."

ASK WHERE 
{
    <%1$s> frm:mappedDatatypeProperty ?mdp .
    ?s ?p ?o .
    FILTER ( ?s != <%1$s> )
    OPTIONAL {?s2 ?p2 ?s . } 
    FILTER ( ! BOUND(?s2) )
}

Failing this sparql query results in the error message: "The supplied description contains triples with a subject other than the map that is not the object of another triple.";

ASK WHERE 
{
  ?anysubject ?anyproperty ?anyvalue .  
  OPTIONAL { <%1$s> ?anyproperty2 ?anyvalue2 . } 
  FILTER (! BOUND(?anyvalue2) )
}

Failing this sparql query results in the error message: "The supplied description contains triples but does not contain one that has the map as its subject.";

Personal tools