#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
NOTE: This only provides a short overview. A much more complete documentation is also available on the LDPath project home.
Define shortcut names for URI prefixes, like in SPARQL or N3.
@prefix PREFIX : <URI>
where PREFIX is a shortcut name for the uri URI.
Example:
@prefix foaf : <http://xmlns.com/foaf/0.1/>;
Predefined Namespaces:
Define fields in the search index to map to path definitions.
[FIELDNAME =] PATH [:: FIELDTYPE] [FIELDCONF]
where
Examples:
title = foaf:name :: xsd:string ;
schema:name = rdfs:label[@en];
geo:lat; geo:long;
<urn:my.company:label.private> = skos:hiddenLabel;
The path language supports a number of path selectors that start at the current "context node" and return a collection of nodes when applied. The following is a short overview over the different selectors, detailed documentation follows below:
Property Selections (URI or prefix:local): select the values of a property
title = foaf:name :: xsd:string ;
title = <http://xmlns.com/foaf/0.1/name> :: xsd:string;
Reverse Property Selections (^URI or ^prefix:local)
childs = ^skos:parent :: xsd:string ;
Wildcard Selections (*): select the values of all properties
all = * :: xsd:string ;
Self Selector (.): select the current context node
Path Traversal (/): follow a path of selectors recursively
friend = foaf:knows/foaf:name :: xsd:string;
Unions (|): join the results of two selections in one collection
friend = foaf:knows/foaf:name | foaf:knows/rdfs:label :: xsd:string;
Intersections (&): build the intersection of the results of two selections
topic_interests = foaf:interest & foaf:topicinterest :: xsd:anyURI;
Recursive Selections ((PATH)+)
skos:broaderTransitive = (skos:broader | ^skos:narrower)+;
Tests ([...]): filter the collection based on test criteria
Language Test (@language): only literals of a certain language
title = rdfs:label[@de] | rdfs:label[@none] :: xsd:string ;
Type Test (^^xsd:type): only literals of a certain type
decimals = *[^^xsd:decimal] :: xsd:decimal
Path Value Test (is): only resources with a subpath yielding a given value
food = foaf:interest[rdf:type is ex:Food] :: xsd:anyURI;
Test Conjunction and Disjunction
foodstuff = foaf:interest[rdf:type is ex:Food | rdf:type is ex:Drink] :: xsd:anyURI ;
fluidfood = foaf:interest[rdf:type is ex:Food & rdf:type is ex:Drink] :: xsd:anyURI ;
Combinations of Tests
foodstuff = foaf:interest[rdf:type is ex:Food]/rdfs:label[@es] :: xsd:string ;
relatedPersons = (* | dc:subject/^dc:subject)[rdf:type is dbp-ont:Person]/rdfs:label[@en] :: xsd:string;
Functions (f(...)): apply a function on the values of the selections passed as argument
friends = foaf:knows/fn:concat(foaf:given," ",foaf:surname) :: xsd:string ;
friends = foaf:knows/(fn:concat(foaf:given," ",foaf:surname) | foaf:name) :: xsd:string ;
label = fn:first(skos:prefLabel[@de], skos:prefLabel) :: xsd:string ;
content = fn:removeTags(ex:hasHtmlContent) :: xsd:string ;
title = fn:xpath("//head/title/text()", ex:hasHtmlContent) :: xsd:string ;
//'fn:content' retrieve the human-readable content (e.g. in HTML) t
// hat is associated with a resource,
content = fn:content(foaf:homepage) :: xsd:string ;