Index: /vlo/branches/vlo-3.3/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java
===================================================================
--- /vlo/branches/vlo-3.3/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java	(revision 6699)
+++ /vlo/branches/vlo-3.3/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java	(revision 6700)
@@ -48,5 +48,4 @@
  * and so on.
  */
-@SuppressWarnings({"serial"})
 public class MetadataImporter {
 
@@ -229,5 +228,6 @@
      * list of existing data roots will be filtered with the list from user
      * 
-     * @return
+     * @param dataRoots complete list of DataRoots
+     * @return list of DataRoots without DataRoots excluded by the user
      */
     protected List<DataRoot> filterDataRootsWithCLArgs(List<DataRoot> dataRoots){
@@ -366,4 +366,6 @@
                         // are usually not very interesting (think imdi corpus files) and will not be included.
                         updateDocument(solrDocument, cmdiData, file, dataOrigin);
+                        if(ResourceStructureGraph.getVertex(cmdiData.getId()) != null)
+                            ResourceStructureGraph.getVertex(cmdiData.getId()).setWasImported(true);
                     } else {
                         nrOfIgnoredFiles++;
@@ -549,4 +551,18 @@
                 }
                 
+                // remove vertices that were not imported
+                Iterator<String> incomingVertexIter = incomingVertexNames.iterator();
+                while(incomingVertexIter.hasNext()) {
+                    String vertexId = incomingVertexIter.next();
+                    if(ResourceStructureGraph.getVertex(vertexId) == null || !ResourceStructureGraph.getVertex(vertexId).getWasImported())
+                        incomingVertexIter.remove();
+                }
+                Iterator<String> outgoingVertexIter = outgoingVertexNames.iterator();
+                while(outgoingVertexIter.hasNext()) {
+                    String vertexId = outgoingVertexIter.next();
+                    if(ResourceStructureGraph.getVertex(vertexId) == null || !ResourceStructureGraph.getVertex(vertexId).getWasImported())
+                        outgoingVertexIter.remove();
+                }
+                
                 if(!incomingVertexNames.isEmpty()) {
                     doc.setField(FacetConstants.FIELD_HAS_PART, incomingVertexNames);
Index: /vlo/branches/vlo-3.3/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/ResourceStructureGraph.java
===================================================================
--- /vlo/branches/vlo-3.3/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/ResourceStructureGraph.java	(revision 6699)
+++ /vlo/branches/vlo-3.3/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/ResourceStructureGraph.java	(revision 6700)
@@ -53,12 +53,13 @@
      */
     public static void addResource(String mdSelfLink) {
-        if (!vertexIdMap.containsKey(mdSelfLink)) {
-            CmdiVertex newVertex = new CmdiVertex(StringUtils.normalizeIdString(mdSelfLink));
-            vertexIdMap.put(mdSelfLink, newVertex);
-        }
-
-        if (!foundVerticesSet.contains(vertexIdMap.get(mdSelfLink))) {
-            graph.addVertex(vertexIdMap.get(mdSelfLink));
-            foundVerticesSet.add(vertexIdMap.get(mdSelfLink));
+        String normalizedMdSelfLink = StringUtils.normalizeIdString(mdSelfLink);
+        if (!vertexIdMap.containsKey(normalizedMdSelfLink)) {
+            CmdiVertex newVertex = new CmdiVertex(normalizedMdSelfLink);
+            vertexIdMap.put(normalizedMdSelfLink, newVertex);
+        }
+
+        if (!foundVerticesSet.contains(vertexIdMap.get(normalizedMdSelfLink))) {
+            graph.addVertex(vertexIdMap.get(normalizedMdSelfLink));
+            foundVerticesSet.add(vertexIdMap.get(normalizedMdSelfLink));
         } else {
             LOG.debug("Duplicate resource vertex mdSelfLink: " + mdSelfLink);
@@ -73,14 +74,17 @@
      */
     public static void addEdge(String sourceVertexId, String targetVertexId) {
+        String normalizedSourceVertexId = StringUtils.normalizeIdString(sourceVertexId);
+        String normalizedTargetVertexId = StringUtils.normalizeIdString(targetVertexId);
+        
         // add vertices
-        if (!vertexIdMap.containsKey(sourceVertexId)) {
-            CmdiVertex sourceVertex = new CmdiVertex(StringUtils.normalizeIdString(sourceVertexId));
-            vertexIdMap.put(sourceVertexId, sourceVertex);
+        if (!vertexIdMap.containsKey(normalizedSourceVertexId)) {
+            CmdiVertex sourceVertex = new CmdiVertex(normalizedSourceVertexId);
+            vertexIdMap.put(normalizedSourceVertexId, sourceVertex);
             graph.addVertex(sourceVertex);
         }
 
-        if (!vertexIdMap.containsKey(targetVertexId)) {
-            CmdiVertex targetVertex = new CmdiVertex(StringUtils.normalizeIdString(targetVertexId));
-            vertexIdMap.put(targetVertexId, targetVertex);
+        if (!vertexIdMap.containsKey(normalizedTargetVertexId)) {
+            CmdiVertex targetVertex = new CmdiVertex(normalizedTargetVertexId);
+            vertexIdMap.put(normalizedTargetVertexId, targetVertex);
             graph.addVertex(targetVertex);
         }
@@ -88,6 +92,6 @@
         // add edge
         try {
-            graph.addEdge(vertexIdMap.get(sourceVertexId), vertexIdMap.get(targetVertexId));
-            updateDepthValues(vertexIdMap.get(sourceVertexId), new HashSet<CmdiVertex>());
+            graph.addEdge(vertexIdMap.get(normalizedSourceVertexId), vertexIdMap.get(normalizedTargetVertexId));
+            updateDepthValues(vertexIdMap.get(normalizedSourceVertexId), new HashSet<CmdiVertex>());
         } catch (IllegalArgumentException cfe) {
             // was a cycle -> ignore
@@ -162,8 +166,16 @@
         return foundVerticesSet;
     }
+    
+    public static CmdiVertex getVertex(String vertexId) {
+        return vertexIdMap.get(vertexId);        
+    }
+    
+    public static Map<String, CmdiVertex> getVertexIdMap() {
+        return vertexIdMap;
+    }
 
     /**
      * Get all vertices that are source of an edge where targetVertex is target.
-     * In other words get all vertices that are part of targetVertex.
+     * In other words get all resource vertices that are part of resource targetVertex.
      *
      * @param targetVertex
@@ -187,5 +199,5 @@
     /**
      * Get all vertices that are target of an edge where sourceVertex is source.
-     * In other words get all vertices of which sourceVertex is part of.
+     * In other words get all resource vertices of which resource sourceVertex is part of.
      *
      * @param sourceVertex
@@ -273,4 +285,5 @@
     private final String id;
     private int hierarchyWeight = 0;
+    private boolean wasImported = false;
 
     public CmdiVertex(String id) {
@@ -288,4 +301,12 @@
     public int getHierarchyWeight() {
         return hierarchyWeight;
+    }
+    
+    public void setWasImported(boolean wasImported) {
+        this.wasImported = wasImported;
+    }
+    
+    public boolean getWasImported() {
+        return wasImported;
     }
 
