@Test public void testPullToStart() { String ns = "http: Property p1 = ResourceFactory.createProperty( ns + "p1" ); Property p2 = ResourceFactory.createProperty( ns + "p2" ); Property p3 = ResourceFactory.createProperty( ns + "p3" ); Resource r1 = ResourceFactory.createResource( ns+"r1"); new DisplayHierarchyNode( dhn.pathTo().append( "p1", p1.getURI(), null ), dhn, new DisplayRdfNode( rm.page(), r1 ), null ); Resource r2 = ResourceFactory.createResource( ns+"r2"); new DisplayHierarchyNode( dhn.pathTo().append( "p2", p2.getURI(), null ), dhn, new DisplayRdfNode( rm.page(), r2 ), null ); Resource r3 = ResourceFactory.createResource( ns+"r3"); new DisplayHierarchyNode( dhn.pathTo().append( "p3", p3.getURI(), null ), dhn, new DisplayRdfNode( rm.page(), r3 ), null ); assertEquals( r1, dhn.children().get( 0 ).rdfNode().asResource() ); assertEquals( r2, dhn.children().get( 1 ).rdfNode().asResource() ); assertEquals( r3, dhn.children().get( 2 ).rdfNode().asResource() ); dhn.pullToStart( p2 ); assertEquals( r2, dhn.children().get( 0 ).rdfNode().asResource() ); assertEquals( r1, dhn.children().get( 1 ).rdfNode().asResource() ); assertEquals( r3, dhn.children().get( 2 ).rdfNode().asResource() ); dhn.pullToStart( p1, p3 ); assertEquals( r1, dhn.children().get( 0 ).rdfNode().asResource() ); assertEquals( r3, dhn.children().get( 1 ).rdfNode().asResource() ); assertEquals( r2, dhn.children().get( 2 ).rdfNode().asResource() ); }
public void pullToStart( Object... properties ) { for( int j = properties.length - 1; j >= 0; j-- ) { Property prop = rdfNode().toProperty( properties[j] ); int index = indexOfChildProperty( prop ); if (index > 0) { DisplayHierarchyNode n = children.get( index ); for (int i = index; i > 0; i--) { children.set( i, children.get( i - 1 ) ); } children.set( 0, n ); } } }
DisplayHierarchyNode { public void pullToStart( Object... properties ) { for( int j = properties.length - 1; j >= 0; j-- ) { Property prop = rdfNode().toProperty( properties[j] ); int index = indexOfChildProperty( prop ); if (index > 0) { DisplayHierarchyNode n = children.get( index ); for (int i = index; i > 0; i--) { children.set( i, children.get( i - 1 ) ); } children.set( 0, n ); } } } }
DisplayHierarchyNode { public void pullToStart( Object... properties ) { for( int j = properties.length - 1; j >= 0; j-- ) { Property prop = rdfNode().toProperty( properties[j] ); int index = indexOfChildProperty( prop ); if (index > 0) { DisplayHierarchyNode n = children.get( index ); for (int i = index; i > 0; i--) { children.set( i, children.get( i - 1 ) ); } children.set( 0, n ); } } } DisplayHierarchyNode( PropertyPath pathTo, DisplayHierarchyNode parent,
                                 DisplayRdfNode rdfNode, ShortNameRenderer shortNameRenderer ); }
DisplayHierarchyNode { public void pullToStart( Object... properties ) { for( int j = properties.length - 1; j >= 0; j-- ) { Property prop = rdfNode().toProperty( properties[j] ); int index = indexOfChildProperty( prop ); if (index > 0) { DisplayHierarchyNode n = children.get( index ); for (int i = index; i > 0; i--) { children.set( i, children.get( i - 1 ) ); } children.set( 0, n ); } } } DisplayHierarchyNode( PropertyPath pathTo, DisplayHierarchyNode parent,
                                 DisplayRdfNode rdfNode, ShortNameRenderer shortNameRenderer ); PropertyPath pathTo(); RDFNodeWrapper terminalLink(); boolean isOnExplicitPath(); Set<PropertyPath> explicitPaths(); DisplayHierarchyNode parent(); boolean isRoot(); DisplayRdfNode rdfNode(); boolean isLoop(); boolean findAncestor( DisplayRdfNode resource ); boolean isLeaf( DisplayHierarchyContext context ); List<DisplayHierarchyNode> children(); void addSibling( DisplayHierarchyNode sibling ); List<DisplayHierarchyNode> siblings(); boolean hasSiblings(); void addHint( String hint ); String hintsString(); boolean hasHint( String hint ); boolean isSimpleResource(); String relatedLinksHTML(); List<Link> relatedLinks(); boolean hasAllProperties( Object... properties ); boolean hasAllProperties( List<Object> properties ); void pullToStart( Object... properties ); void pullToStart( List<Object> properties ); List<DisplayHierarchyNode> extractByPredicate( Object... properties ); List<DisplayHierarchyNode> extractByPredicate( List<Object> properties ); boolean isResource(); boolean isLiteral(); boolean isAnon(); boolean isList(); String getLexicalForm(); String getName(); Object getValue(); String getURI(); @Override String toString(); }
DisplayHierarchyNode { public void pullToStart( Object... properties ) { for( int j = properties.length - 1; j >= 0; j-- ) { Property prop = rdfNode().toProperty( properties[j] ); int index = indexOfChildProperty( prop ); if (index > 0) { DisplayHierarchyNode n = children.get( index ); for (int i = index; i > 0; i--) { children.set( i, children.get( i - 1 ) ); } children.set( 0, n ); } } } DisplayHierarchyNode( PropertyPath pathTo, DisplayHierarchyNode parent,
                                 DisplayRdfNode rdfNode, ShortNameRenderer shortNameRenderer ); PropertyPath pathTo(); RDFNodeWrapper terminalLink(); boolean isOnExplicitPath(); Set<PropertyPath> explicitPaths(); DisplayHierarchyNode parent(); boolean isRoot(); DisplayRdfNode rdfNode(); boolean isLoop(); boolean findAncestor( DisplayRdfNode resource ); boolean isLeaf( DisplayHierarchyContext context ); List<DisplayHierarchyNode> children(); void addSibling( DisplayHierarchyNode sibling ); List<DisplayHierarchyNode> siblings(); boolean hasSiblings(); void addHint( String hint ); String hintsString(); boolean hasHint( String hint ); boolean isSimpleResource(); String relatedLinksHTML(); List<Link> relatedLinks(); boolean hasAllProperties( Object... properties ); boolean hasAllProperties( List<Object> properties ); void pullToStart( Object... properties ); void pullToStart( List<Object> properties ); List<DisplayHierarchyNode> extractByPredicate( Object... properties ); List<DisplayHierarchyNode> extractByPredicate( List<Object> properties ); boolean isResource(); boolean isLiteral(); boolean isAnon(); boolean isList(); String getLexicalForm(); String getName(); Object getValue(); String getURI(); @Override String toString(); static final String SORT_BY_FORMAT; static final int MAX_RELATED_LINK_LABEL_LENGTH; }