/** * Return the value of the parameter if set, or null otherwise. Note command line * has precedence. * * @return The argument value as an RDFNode */ protected RDFNode getValue( List<String> cmdLineArgs, Resource confRoot ) { int index = cmdLineArgs.indexOf( m_cmdLineForm ); if (index >= 0) { try { return ResourceFactory.createPlainLiteral( cmdLineArgs.get( index + 1 ) ); } catch (IndexOutOfBoundsException e) { throw new SchemagenException( "Value for parameter " + m_cmdLineForm + " not set! Aborting.", e ); } } if (m_prop != null && confRoot != null && confRoot.hasProperty( m_prop )) { return confRoot.getRequiredProperty( m_prop ).getObject(); } // not set return null; }
return ResourceFactory.createLangLiteral(lex, lang); } else { return ResourceFactory.createPlainLiteral(lex);
/** * <p>Remove the statement that the given string provides version information about * this resource. If this statement * is not true of the current model, nothing happens.</p> * @param info A version information string to be removed */ @Override public void removeVersionInfo( String info ) { checkProfile( getProfile().VERSION_INFO(), "VERSION_INFO" ); Literal infoAsLiteral = ResourceFactory.createPlainLiteral( info ); getModel().remove( this, getProfile().VERSION_INFO(), infoAsLiteral ); }
node = ResourceFactory.createPlainLiteral(value); return;
@Test public void testPathTo() { PropertyPath fooBar = new PropertyPath( "foo.bar" ); DisplayHierarchyNode child = new DisplayHierarchyNode( fooBar, dhn, new DisplayRdfNode( rm.page(), ResourceFactory.createPlainLiteral( "foo" ) ), null ); assertSame( fooBar, child.pathTo() ); }
@Test public void testParent() { assertNull( dhn.parent() ); assertTrue( dhn.isRoot() ); DisplayHierarchyNode child = new DisplayHierarchyNode( new PropertyPath( "fu" ), dhn, new DisplayRdfNode( rm.page(), ResourceFactory.createPlainLiteral( "foo" ) ), null ); assertSame( dhn, child.parent() ); assertFalse( child.isRoot() ); }
proofIndividual, ResourceFactory.createProperty(DEFACTO_PROPERTY_CONTEXT), ResourceFactory.createPlainLiteral(proof.getTinyContext()))); proofIndividual, ResourceFactory.createProperty(LANGUAGE_PROPERTY), ResourceFactory.createPlainLiteral(proof.getLanguage())));
@Test public void testIsLeaf() { DisplayHierarchyContext dhc = contextFixture( false, "dhc" ); // not a leaf assertFalse( dhn.isLeaf( dhc )); // literal is a leaf DisplayHierarchyNode c0 = new DisplayHierarchyNode( new PropertyPath(), dhn, new DisplayRdfNode( rm.page(), ResourceFactory.createPlainLiteral( "foo" ) ), null ); assertTrue( c0.isLeaf( dhc )); // seen is a leaf Resource r0 = ResourceFactory.createResource( "http://example/foo#r0"); DisplayHierarchyContext dhc1 = contextFixture( true, "dhc1" ); DisplayHierarchyNode c3 = new DisplayHierarchyNode( new PropertyPath( "fu" ), dhn, new DisplayRdfNode( rm.page(), r0 ), null ); assertTrue( c3.isLeaf( dhc1 )); // node on explicit path is not a leaf c3.explicitPaths().add( new PropertyPath( "*" ) ); assertFalse( c3.isLeaf( dhc1 )); }