001: /*
002: (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: All rights reserved - see end of file.
004: $Id: Assembler.java,v 1.11 2008/01/18 09:43:48 chris-dollin Exp $
005: */
006:
007: package com.hp.hpl.jena.assembler;
008:
009: import com.hp.hpl.jena.assembler.assemblers.*;
010: import com.hp.hpl.jena.rdf.model.*;
011:
012: /**
013: An Assembler creates objects from their RDF descriptions. The root motivation
014: is to create Models, but other objects are required as sub-components of
015: those Models, so a general mechanism is available.
016:
017: @author kers
018: */
019: public interface Assembler {
020: /**
021: The core operation: answer a new object constructed according to the
022: object description hanging from <code>root</code>, using the assembler
023: <code>a</code> for any sub-objects. Use <code>mode</code> to decide
024: if persistent objects are to be re-used or created; this mode is passed down
025: to all sub-object construction.
026: */
027: public Object open(Assembler a, Resource root, Mode mode);
028:
029: /**
030: Answer <code>open( a, root, Mode.DEFAULT )</code>.
031: */
032: public Object open(Assembler a, Resource root);
033:
034: /**
035: Answer <code>open( this, root, Mode.DEFAULT )</code>.
036: */
037: public Object open(Resource root);
038:
039: /**
040: Answer <code>(Model) open( this, root, Mode.DEFAULT )</code>, unless
041: the result cannot be or is not a Model, in which case throw an exception.
042: */
043: public Model openModel(Resource root);
044:
045: /**
046: Answer <code>(Model) open( this, root, mode )</code>, unless
047: the result cannot be or is not a Model, in which case throw an exception.
048: */
049: public Model openModel(Resource root, Mode mode);
050:
051: public static final Assembler defaultModel = new DefaultModelAssembler();
052:
053: public static final Assembler memoryModel = new MemoryModelAssembler();
054:
055: public static final Assembler infModel = new InfModelAssembler();
056:
057: public static final Assembler rdbModel = new RDBModelAssembler();
058:
059: public static final Assembler ontModel = new OntModelAssembler();
060:
061: public static final Assembler reasonerFactory = new ReasonerFactoryAssembler();
062:
063: public static final Assembler content = new ContentAssembler();
064:
065: public static final Assembler connection = new ConnectionAssembler();
066:
067: public static final Assembler prefixMapping = new PrefixMappingAssembler();
068:
069: public static final Assembler fileModel = new FileModelAssembler();
070:
071: public static final Assembler unionModel = new UnionModelAssembler();
072:
073: public static final Assembler ontModelSpec = new OntModelSpecAssembler();
074:
075: public static final Assembler ruleSet = new RuleSetAssembler();
076:
077: public static final Assembler modelSource = new ModelSourceAssembler();
078:
079: public static final Assembler locationMapper = new LocationMapperAssembler();
080:
081: public static final Assembler fileManager = new FileManagerAssembler();
082:
083: public static final Assembler documentManager = new DocumentManagerAssembler();
084:
085: public static final AssemblerGroup general = AssemblerGroup
086: .create().implementWith(JA.DefaultModel, defaultModel)
087: .implementWith(JA.MemoryModel, memoryModel).implementWith(
088: JA.InfModel, infModel).implementWith(
089: JA.ReasonerFactory, reasonerFactory).implementWith(
090: JA.ModelSource, modelSource).implementWith(
091: JA.RDBModelSource, modelSource).implementWith(
092: JA.Content, content).implementWith(JA.ContentItem,
093: content).implementWith(JA.Connection, connection)
094: .implementWith(JA.RDBModel, rdbModel).implementWith(
095: JA.UnionModel, unionModel).implementWith(
096: JA.PrefixMapping, prefixMapping).implementWith(
097: JA.FileModel, fileModel).implementWith(JA.OntModel,
098: ontModel).implementWith(JA.OntModelSpec,
099: ontModelSpec).implementWith(JA.RuleSet, ruleSet)
100: .implementWith(JA.LocationMapper, locationMapper)
101: .implementWith(JA.FileManager, fileManager).implementWith(
102: JA.DocumentManager, documentManager);
103: }
104:
105: /*
106: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
107: * All rights reserved.
108: *
109: * Redistribution and use in source and binary forms, with or without
110: * modification, are permitted provided that the following conditions
111: * are met:
112: * 1. Redistributions of source code must retain the above copyright
113: * notice, this list of conditions and the following disclaimer.
114: * 2. Redistributions in binary form must reproduce the above copyright
115: * notice, this list of conditions and the following disclaimer in the
116: * documentation and/or other materials provided with the distribution.
117: * 3. The name of the author may not be used to endorse or promote products
118: * derived from this software without specific prior written permission.
119: *
120: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
121: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
122: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
123: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
124: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
125: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
126: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
127: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
128: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
129: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
130: */
|