@Override public Resource map1(Statement o) { return o.getResource(); } });
@Override public Resource getResource(int index) { return getRequiredProperty(RDF.li(index)).getResource(); }
private void addRulesFromURLs( Resource value ) { Iterator<Statement> that = getRuleSetURLStatements( value ); while (that.hasNext()) addRules( Rule.rulesFromURL( that.next().getResource().getURI() ) ); }
private List<Model> getSubModels( Assembler a, Resource root, Mode mode ) { List<Model> result = new ArrayList<Model>(); for (StmtIterator it = root.listProperties( JA.subModel ); it.hasNext();) result.add( a.openModel( it.nextStatement().getResource(), mode ) ); return result; }
private boolean wTypedNode(Resource r) { Statement st = getType(r); if (st == null) return false; Resource type = st.getResource(); done(st); return wTypedNodeOrDescription(wtype, type, r); }
public static Resource getResourceValue(Resource r, Property p) { if ( ! atmostOneProperty(r, p) ) throw new NotUniqueException(r, p) ; Statement s = r.getProperty(p) ; if ( s == null ) return null ; return s.getResource() ; }
public static Resource getResourceValue(Resource r, Property p) { if ( ! atmostOneProperty(r, p) ) throw new NotUniqueException(r, p) ; Statement s = r.getProperty(p) ; if ( s == null ) return null ; return s.getResource() ; }
private boolean isSeq(RDFNode n) { if (n.isResource()) { Statement st = n.asResource().getProperty(pRdfType); if (st != null) return RDF_SEQ.equals(st.getResource().getURI()); } return false; }
private boolean isBag(RDFNode n) { if (n.isResource()) { Statement st = n.asResource().getProperty(pRdfType); if (st != null) return RDF_BAG.equals(st.getResource().getURI()); } return false; }
private boolean isType(Resource r, Resource resourceClass){ //Test for type of subject (if any) Resource candidateResourceClass = r.getProperty(new PropertyImpl("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")).getResource(); if(candidateResourceClass != null && candidateResourceClass.equals(resourceClass)){ return true; } return false; }
private Resource getItemsResource( Resource x ) { StmtIterator sit = x.listProperties( API.items ); return sit.hasNext() ? sit.next().getResource() : null; }
public static Mode decode( Resource root, Mode defaultMode ) { if (root == null) return defaultMode; Statement s = root.getProperty( ELDA_API.shortnameMode ); if (s == null) return defaultMode; Resource mode = s.getResource(); return mode.equals(ELDA_API.preferPrefixes) ? CompleteContext.Mode.PreferPrefixes : mode.equals(ELDA_API.preferLocalnames) ? CompleteContext.Mode.PreferLocalnames : mode.equals(ELDA_API.roundTrip) ? CompleteContext.Mode.RoundTrip : defaultMode ; } }
@Override public void addedStatement( Statement added ) { if (added.getPredicate().equals( getProfile().IMPORTS() )) { getDocumentManager().loadImport( OntModelImpl.this, added.getResource().getURI() ); } }
@Override public void removedStatement( Statement removed ) { if (removed.getPredicate().equals( getProfile().IMPORTS() )) { getDocumentManager().unloadImport( OntModelImpl.this, removed.getResource().getURI() ); } } }
private ATermList createList(Resource r) { if(r.equals(RDF.nil)) return ATermUtils.EMPTY_LIST; else if(!rawModel.contains(r, RDF.first)) { System.err.println("Invalid list structure: List " + r + " does not have a rdf:first property. Ignoring rest of the list."); return ATermUtils.EMPTY_LIST; } ATerm first = node2term(rawModel.getProperty(r, RDF.first).getObject()); Resource rest = rawModel.getProperty(r, RDF.rest).getResource(); return ATermUtils.makeList(first, createList(rest)); } // createList
public static String getAsStringValue(Resource r, Property p) { if ( ! atmostOneProperty(r, p) ) throw new NotUniqueException(r, p) ; Statement s = r.getProperty(p) ; if ( s == null ) return null ; if ( s.getObject().isResource() ) return s.getResource().getURI() ; return s.getString() ; }
protected Content getInitialContent( Assembler a, Resource root ) { Model partial = ModelFactory.createDefaultModel(); Resource combined = partial.createResource(); for (StmtIterator it = root.listProperties( JA.initialContent ); it.hasNext();) transferContentProperties( partial, it.nextStatement().getResource(), combined ); return contentFromModel( a, root, partial, combined ); }
public static String getAsStringValue(Resource r, Property p) { if ( ! atmostOneProperty(r, p) ) throw new NotUniqueException(r, p) ; Statement s = r.getProperty(p) ; if ( s == null ) return null ; if ( s.getObject().isResource() ) return s.getResource().getURI() ; return s.getString() ; }
@Test public void testBuildFromPropertyList() { View v = new View(); Model m = ModelIOUtils.modelFromTurtle( "@prefix : <eh:/>. :root owl:sameAs (:p :q)." ); Statement s = m.listStatements( null, OWL.sameAs, (RDFNode) null ).next(); v.addViewFromRDFList( s.getResource(), sns ); List<PropertyChain> chains = v.chains(); assertEquals(1, chains.size()); List<ViewProperty> chain = chains.get(0).getProperties(); assertEquals(2, chain.size()); assertEquals("eh:/p", chain.get(0).toString()); assertEquals("eh:/q", chain.get(1).toString()); }
private void extractSingleModelprefixFromTo( Statement s ) { Resource S = s.getSubject(); if (s.getObject().isLiteral()) throw new EldaException( "Object of editPrefix property of " + S + " is a literal." ); Resource edit = s.getResource(); String from = getStringValue( edit, ELDA_API.ifStarts ); if (from == null) throw new EldaException( "Missing from for " + S ); String to = getStringValue( edit, ELDA_API.replaceStartBy ); if (to == null) throw new EldaException( "Missing elda:to for " + S ); modelPrefixEditor.set(from, to); }