Author: reto
Date: Wed Apr 11 08:58:25 2012
New Revision: 1324653

URL: http://svn.apache.org/viewvc?rev=1324653&view=rev
Log:
A draft for a facade to faceted search

Added:
    incubator/stanbol/branches/faceted-browsing/pom.xml
    incubator/stanbol/branches/faceted-browsing/src/
    incubator/stanbol/branches/faceted-browsing/src/main/
    incubator/stanbol/branches/faceted-browsing/src/main/java/
    incubator/stanbol/branches/faceted-browsing/src/main/java/org/
    incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/
    
incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/stanbol/
    
incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/stanbol/contenthub/
    
incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/stanbol/contenthub/faceted/
    
incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/stanbol/contenthub/faceted/ConstrainedDocumentSet.java
    incubator/stanbol/branches/faceted-browsing/src/main/resources/
Modified:
    incubator/stanbol/branches/faceted-browsing/   (props changed)

Propchange: incubator/stanbol/branches/faceted-browsing/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Apr 11 08:58:25 2012
@@ -0,0 +1 @@
+target

Added: incubator/stanbol/branches/faceted-browsing/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/faceted-browsing/pom.xml?rev=1324653&view=auto
==============================================================================
--- incubator/stanbol/branches/faceted-browsing/pom.xml (added)
+++ incubator/stanbol/branches/faceted-browsing/pom.xml Wed Apr 11 08:58:25 2012
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.apache.stanbol</groupId>
+               <artifactId>stanbol-parent</artifactId>
+               <version>0.9.0-incubating-SNAPSHOT</version>
+       </parent>
+
+       <artifactId>org.apache.stanbol.contenthub.faceted</artifactId>
+       <packaging>bundle</packaging>
+       <version>0.1.0-SNAPSHOT</version>
+
+       <name>Faceted search/browsing API</name>
+       <description>
+    </description>
+
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-scr-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <extensions>true</extensions>
+                       </plugin>
+               </plugins>
+       </build>
+       <dependencies>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.compendium</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>servlet-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.contenthub.servicesapi</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.felix</groupId>
+                       
<artifactId>org.apache.felix.scr.annotations</artifactId>
+                       <version>1.6.0</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+               </dependency>
+       </dependencies>
+</project>

Added: 
incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/stanbol/contenthub/faceted/ConstrainedDocumentSet.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/stanbol/contenthub/faceted/ConstrainedDocumentSet.java?rev=1324653&view=auto
==============================================================================
--- 
incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/stanbol/contenthub/faceted/ConstrainedDocumentSet.java
 (added)
+++ 
incubator/stanbol/branches/faceted-browsing/src/main/java/org/apache/stanbol/contenthub/faceted/ConstrainedDocumentSet.java
 Wed Apr 11 08:58:25 2012
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2012 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.stanbol.contenthub.faceted;
+
+import java.util.Locale;
+import java.util.Set;
+import org.apache.clerezza.rdf.core.Resource;
+import org.apache.clerezza.rdf.core.UriRef;
+
+/**
+ * A set of documents that can be narrowed by applying constraints that are 
+ * grouped by facets. Instances of this class are immutable, narrowing and 
+ * broadening return new instances.
+ */
+public interface ConstrainedDocumentSet {
+       
+       /**
+        * A constraint requires a document property to have a certain value
+        */
+       //TODO two versions of Constraint one with value (like this one) and 
the other with a value range
+       interface Constraint {
+               /**
+                * 
+                * @return the facet this constraint relates too
+                */
+               Facet getFacet();
+               
+               /**
+                * 
+                * @return the URIRef of Literal that documents matching this 
constraint have as value of this facet
+                */
+               Resource getValue();
+       }
+       
+       /**
+        * A facet (aspect) by which the ConstrainedDocumentSet can be narrowed
+        */
+       interface Facet {
+               
+               /**
+                * 
+                * @return a set of constraints that reduce the document to a 
non-empty set
+                */
+               Set<Constraint> getConstraints();
+               
+               /**
+                * 
+                * @return The property this facet maps too
+                */
+               UriRef getProperty();
+               
+               /**
+                * 
+                * @param locale the desired locale or null if no preference
+                * @return a label for this facet
+                */
+               String getLabel(Locale locale);
+               
+       }
+       
+       
+       /**
+        * Note that this method might be implemented so that getting the size 
of
+        * the set doesn't require enumerating the documents
+        * 
+        * @return the documents matching this ConstrainedDocumentSet
+        */
+       //TODO is just retuning the UriRef enough of should we rettur a 
DocumentResult or use ContentItem
+       Set<UriRef> getDocuments();
+       
+       /**
+        * This is the breadcrumb of this ConstrainedDocumentSet
+        * 
+        * @return the constrains that apply to this ConstrainedDocumentSet 
(might be empty)
+        */
+       Set<Constraint> getConstraints();
+       
+       /**
+        * 
+        * @return the facets by which this ConstrainedDocumentSet can be 
restricted
+        */
+       Set<Facet> getFacets();
+       
+       /**
+        * Note that the new set need not to be computed when this method is 
called,
+        * the matching document might be computed when needed. So 
implimentations
+        * can provided efficient way to allow a client to call
+        * 
+        * <code>narrow(additionalConstraint).getDocuments().size()</code>
+        * 
+        * @param constraint the additional constraint to apply
+        * @return the ConstrainedDocumentSet with that additional constraint
+        */
+       ConstrainedDocumentSet narrow(Constraint constraint);
+       
+       /**
+        * Removes a constraint
+        * 
+        * @param constraint the constraint which must be be member of the set 
returned by getConstraints()
+        * @return the broadened ConstrainedDocumentSet
+        */
+       ConstrainedDocumentSet broaden(Constraint constraint);
+       
+}


Reply via email to