001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.jena; 014 015import static org.apache.juneau.jena.Constants.*; 016 017import org.apache.juneau.*; 018 019/** 020 * Subclass of {@link RdfSerializer} for serializing RDF in N3 notation. 021 */ 022public class N3Serializer extends RdfSerializer { 023 024 //------------------------------------------------------------------------------------------------------------------- 025 // Predefined instances 026 //------------------------------------------------------------------------------------------------------------------- 027 028 /** Default N3 serializer, all default settings.*/ 029 public static final N3Serializer DEFAULT = new N3Serializer(PropertyStore.DEFAULT); 030 031 //------------------------------------------------------------------------------------------------------------------- 032 // Instance 033 //------------------------------------------------------------------------------------------------------------------- 034 035 /** 036 * Instantiates a new clean-slate {@link RdfSerializerBuilder} object. 037 * 038 * <p> 039 * Note that this method creates a builder initialized to all default settings, whereas {@link #builder()} copies 040 * the settings of the object called on. 041 * 042 * @return A new {@link RdfSerializerBuilder} object. 043 */ 044 public static RdfSerializerBuilder create() { 045 return new RdfSerializerBuilder().n3(); 046 } 047 048 /** 049 * Constructor. 050 * 051 * @param ps The property store containing all the settings for this object. 052 */ 053 public N3Serializer(PropertyStore ps) { 054 super( 055 ps.builder() 056 .set(RDF_language, LANG_N3) 057 .build(), 058 "text/n3", null 059 ); 060 } 061}