001: /*
002: (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: All rights reserved - see end of file.
004: $Id: TestReificationPredicates.java,v 1.4 2008/01/02 12:05:33 andy_seaborne Exp $
005: */
006:
007: package com.hp.hpl.jena.graph.test;
008:
009: import com.hp.hpl.jena.graph.*;
010: import com.hp.hpl.jena.vocabulary.RDF;
011:
012: import junit.framework.*;
013:
014: /**
015: Tests that the predicates for recognising [parts of] reification quadlets,
016: parked in Reifier.Util, work as required.
017:
018: @author kers
019: */
020: public class TestReificationPredicates extends GraphTestBase {
021: public TestReificationPredicates(String name) {
022: super (name);
023: }
024:
025: public static TestSuite suite() {
026: return new TestSuite(TestReificationPredicates.class);
027: }
028:
029: public void testSubject() {
030: assertTrue(Reifier.Util
031: .isReificationPredicate(RDF.Nodes.subject));
032: }
033:
034: public void testPredicate() {
035: assertTrue(Reifier.Util
036: .isReificationPredicate(RDF.Nodes.predicate));
037: }
038:
039: public void testObject() {
040: assertTrue(Reifier.Util
041: .isReificationPredicate(RDF.Nodes.object));
042: }
043:
044: public void testRest() {
045: assertFalse(Reifier.Util.isReificationPredicate(RDF.Nodes.rest));
046: }
047:
048: public void testFirst() {
049: assertFalse(Reifier.Util
050: .isReificationPredicate(RDF.Nodes.first));
051: }
052:
053: public void testType() {
054: assertFalse(Reifier.Util.isReificationPredicate(RDF.Nodes.type));
055: }
056:
057: public void testValue() {
058: assertFalse(Reifier.Util
059: .isReificationPredicate(RDF.Nodes.value));
060: }
061:
062: public void testSubjectInOtherNamespace() {
063: assertFalse(Reifier.Util
064: .isReificationPredicate(node("subject")));
065: }
066:
067: public void testStatementCouldBeStatement() {
068: assertTrue(Reifier.Util.couldBeStatement(RDF.Nodes.Statement));
069: }
070:
071: public void testVariableCouldBeStatement() {
072: assertTrue(Reifier.Util.couldBeStatement(node("?x")));
073: }
074:
075: public void testANYCouldBeStatement() {
076: assertTrue(Reifier.Util.couldBeStatement(Node.ANY));
077: }
078:
079: public void testPropertyCouldNotBeStatement() {
080: assertFalse(Reifier.Util.couldBeStatement(RDF.Nodes.Property));
081: }
082:
083: public void testOtherStatementCouldBeStatement() {
084: assertFalse(Reifier.Util.couldBeStatement(node("Statement")));
085: }
086:
087: public void testAltIsntIsReificationType() {
088: assertFalse(Reifier.Util.isReificationType(RDF.Nodes.type,
089: RDF.Nodes.Alt));
090: }
091:
092: public void testBagIsntIsReificationType() {
093: assertFalse(Reifier.Util.isReificationType(RDF.Nodes.type,
094: RDF.Nodes.Bag));
095: }
096:
097: public void testOtherStatementIsntIsReificationType() {
098: assertFalse(Reifier.Util.isReificationType(RDF.Nodes.type,
099: node("Statement")));
100: }
101:
102: public void testValueIsNtReificationType() {
103: assertFalse(Reifier.Util.isReificationType(RDF.Nodes.value,
104: RDF.Nodes.Statement));
105: }
106:
107: public void testValuePropertyIsntreificationType() {
108: assertFalse(Reifier.Util.isReificationType(RDF.Nodes.value,
109: RDF.Nodes.Property));
110: }
111:
112: public void testStatementIsReificationType() {
113: assertTrue(Reifier.Util.isReificationType(RDF.Nodes.type,
114: RDF.Nodes.Statement));
115: }
116:
117: public void testVariableIsReificationType() {
118: assertTrue(Reifier.Util.isReificationType(RDF.Nodes.type,
119: node("?x")));
120: }
121:
122: public void testANYIsReificationType() {
123: assertTrue(Reifier.Util.isReificationType(RDF.Nodes.type,
124: Node.ANY));
125: }
126: }
127:
128: /*
129: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
130: * All rights reserved.
131: *
132: * Redistribution and use in source and binary forms, with or without
133: * modification, are permitted provided that the following conditions
134: * are met:
135: * 1. Redistributions of source code must retain the above copyright
136: * notice, this list of conditions and the following disclaimer.
137: * 2. Redistributions in binary form must reproduce the above copyright
138: * notice, this list of conditions and the following disclaimer in the
139: * documentation and/or other materials provided with the distribution.
140: * 3. The name of the author may not be used to endorse or promote products
141: * derived from this software without specific prior written permission.
142: *
143: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
144: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
145: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
146: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
147: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
148: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
149: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
150: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
151: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
152: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
153: */
|