/* ModelUtil.java * * Copyright (c) 2003 by Benja Fallenstein * * This file is part of Fenfire. * * Fenfire is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Fenfire is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with Fenfire; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * */ /* * Written by Benja Fallenstein */ package gzz.loom; import com.hp.hpl.mesa.rdf.jena.model.*; /** A class containing URIs from the rdf namespace. * Instances of this class contain Property and Resource * instances from a given Model (passed to the constructor). */ public class RDFVocab { protected final Model model; public static final String namespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; public final Property type; /** Get a property like rdf:_2, rdf:_7 etc. */ public Property _(int n) throws RDFException { if(n<1) throw new IllegalArgumentException(n+" < 1"); return model.getProperty(namespace, "_"+n); } public boolean isNumericProperty(Property p) { return p.toString().startsWith(namespace + "_"); } public RDFVocab(Model model) throws RDFException { this.model = model; type = model.getProperty(namespace, "type"); } }