/*
 * Copyright 2012  Research Studios Austria Forschungsges.m.b.H.
 *
 *    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 won.protocol.util;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.shared.PrefixMapping;
import org.apache.jena.vocabulary.DC;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import org.apache.jena.vocabulary.XSD;
import won.protocol.vocabulary.*;

/**
 * User: fkleedorfer
 * Date: 27.09.13
 */
public class DefaultPrefixUtils
{
  /**
   * Sets the default prefixes on the specified model.
   * @param model
   */
  public static void setDefaultPrefixes(Model model) {
    setDefaultPrefixes(model.getGraph().getPrefixMapping());
  }

  /**
   * * Sets the default prefixes on the specified prefixMapping.
   * @param prefixMapping
   */
  public static void setDefaultPrefixes(PrefixMapping prefixMapping) {
    prefixMapping.setNsPrefix("won", WON.getURI());
    prefixMapping.setNsPrefix(WONMSG.DEFAULT_PREFIX, WONMSG.getURI());
    prefixMapping.setNsPrefix(WONCRYPT.DEFAULT_PREFIX, WONCRYPT.getURI());
    prefixMapping.setNsPrefix(SFSIG.DEFAULT_PREFIX, SFSIG.getURI());
    prefixMapping.setNsPrefix(CERT.DEFAULT_PREFIX, CERT.getURI());
    prefixMapping.setNsPrefix("sioc", SIOC.getURI());
    prefixMapping.setNsPrefix("rdf", RDF.getURI());
    prefixMapping.setNsPrefix("ldp", LDP.getURI());
    prefixMapping.setNsPrefix("rdfs", RDFS.getURI());
    prefixMapping.setNsPrefix("geo", GEO.getURI());
    prefixMapping.setNsPrefix("xsd", XSD.getURI());
    prefixMapping.setNsPrefix("dc", DC.getURI());    
  }

  public static PrefixMapping getDefaultPrefixes(){
    PrefixMapping ret = PrefixMapping.Factory.create();
    setDefaultPrefixes(ret);
    return ret;
  }
}

@@ -1037,17 +1037,21 @@
 tils
-%0A
+ 
 %7B%0A  
+ 
+ 
 /**%0A
+  
    *
@@ -1101,16 +1101,25 @@
  model.%0A
+     *%0A  
    * @pa
@@ -1127,27 +1127,31 @@
 am model%0A   
+  
 */%0A
+  
   public sta
@@ -1193,24 +1193,28 @@
 odel) %7B%0A    
+  
+  
 setDefaultPr
@@ -1258,21 +1258,25 @@
 ing());%0A
+  
   %7D%0A%0A
+  
   /**%0A  
@@ -1276,16 +1276,18 @@
  /**%0A   
+  
 * * Sets
@@ -1340,16 +1340,25 @@
 apping.%0A
+     *%0A  
    * @pa
@@ -1378,19 +1378,23 @@
 ping%0A   
+  
 */%0A
+  
   public
@@ -1452,24 +1452,28 @@
 xMapping) %7B%0A
+    
     prefixMa
@@ -1504,32 +1504,36 @@
  WON.getURI());%0A
+    
     prefixMappin
@@ -1583,32 +1583,36 @@
 .getURI());%0A    
+   
+ 
 prefixMapping.se
@@ -1658,32 +1658,36 @@
 RYPT.getURI());%0A
+    
     prefixMappin
@@ -1731,32 +1731,36 @@
 FSIG.getURI());%0A
+    
     prefixMappin
@@ -1806,32 +1806,36 @@
 .getURI());%0A    
+ 
+   
 prefixMapping.se
@@ -1864,32 +1864,36 @@
 .getURI());%0A    
+   
+ 
 prefixMapping.se
@@ -1916,32 +1916,36 @@
  RDF.getURI());%0A
+    
     prefixMappin
@@ -1972,32 +1972,36 @@
  LDP.getURI());%0A
+    
     prefixMappin
@@ -2034,32 +2034,36 @@
 .getURI());%0A    
+ 
+   
 prefixMapping.se
@@ -2090,32 +2090,36 @@
 .getURI());%0A    
+  
+  
 prefixMapping.se
@@ -2146,24 +2146,28 @@
 .getURI());%0A
+    
     prefixMa
@@ -2207,18 +2207,80 @@
 ());
-    %0A
+%0A        prefixMapping.setNsPrefix(%22s%22, %22http://schema.org/%22);%0A  
   %7D%0A%0A
+  
   pu
@@ -2325,18 +2325,23 @@
 efixes()
+ 
 %7B%0A
+    
     Pref
@@ -2388,16 +2388,20 @@
 eate();%0A
+    
     setD
@@ -2421,16 +2421,20 @@
 s(ret);%0A
+    
     retu
@@ -2441,14 +2441,16 @@
 rn ret;%0A
+  
   %7D%0A%7D%0A

add schem.org prefix to default prefixes on server