if (r.hasProperty(VCARD4.fn)) { vcard.setFormattedName(r.getProperty(VCARD4.fn).getString()); if (r.hasProperty(VCARD4.hasName)) { StmtIterator nameIterator = r.listProperties(VCARD4.hasName); while (nameIterator.hasNext()) { Resource structuredNameResource = nameStatement.getResource(); StructuredName structuredName = new StructuredName(); if (structuredNameResource.hasProperty(VCARD4.family_name)) { structuredName.setFamily(structuredNameResource.getProperty(VCARD4.family_name).getString()); if (structuredNameResource.hasProperty(VCARD4.given_name)) { structuredName.setGiven(structuredNameResource.getProperty(VCARD4.given_name).getString()); if (r.hasProperty(VCARD4.organization_name)) { vcard.setOrganization(r.getProperty(VCARD4.organization_name).getString()); if (r.hasProperty(VCARD4.hasEmail)) { r.listProperties(VCARD4.hasEmail).forEachRemaining(emailStatement -> { Resource emailResource = emailStatement.getResource(); String emailAddress = matcher.group(1); Email email = new Email(emailAddress); if (emailResource.hasProperty(RDF.type)) { emailResource.listProperties(RDF.type).forEachRemaining(typeProperty -> email.getTypes().add(EmailType.find(typeProperty.getResource().getLocalName()))); if (r.hasProperty(VCARD4.hasTelephone)) {
@Override public Resource accept(Resource o) { Resource r = o; return (r.hasProperty(RDF.subject) && r.hasProperty(RDF.object) && r .hasProperty(RDF.predicate)) ? r : null; } }, model.listResourcesWithProperty(RDF.type, RDF.Statement));
private static boolean testResourceCovered( List< ? extends Resource> l, Property rel, boolean inverse, Resource r ) { boolean rCovered = false; for (Iterator< ? extends Resource> i = l.iterator(); !rCovered && i.hasNext(); ) { Resource next = i.next(); rCovered = inverse ? r.hasProperty( rel, next ) : next.hasProperty( rel, r ); } return rCovered; }
private static void removeElementsWithoutType( Set<Resource> candidates, Resource type ) { for (Iterator<Resource> it = candidates.iterator(); it.hasNext();) { Resource candidate = it.next(); if (!candidate.hasProperty( RDF.type, type )) it.remove(); } }
private static void removeElementsWithoutType( Set<Resource> candidates, Resource type ) { for (Iterator<Resource> it = candidates.iterator(); it.hasNext();) { Resource candidate = it.next(); if (!candidate.hasProperty( RDF.type, type )) it.remove(); } }
private static boolean hasNoCompetingSubclass( List<RDFNode> types, Resource candidate ) { for ( RDFNode type : types ) { Resource other = (Resource) type; if ( other.hasProperty( RDFS.subClassOf, candidate ) && !candidate.equals( other ) ) { return false; } } return true; }
@Override public Analyzer open(Assembler a, Resource root, Mode mode) { if (root.hasProperty(TextVocab.pStopWords)) { return analyzerWithStopWords(root); } else { return new StandardAnalyzer(); } }
protected void checkType( Resource root, Resource type ) { if (!root.hasProperty( RDF.type, type )) throw new CannotConstructException( this.getClass(), root, type ); }
private boolean evaluate(Resource r) { // a message is only available to sender or recipient if (r.hasProperty(RDF.type, msgType)) { return r.hasProperty(pTo, principal.getName()) || r.hasProperty(pFrom, principal.getName()); } return true; }
public void testString() { Assert.assertTrue(r.hasProperty(RDF.value, AbstractModelTestBase.tvString)); }
public void testStringWithLanguage() { Assert.assertTrue(r.hasProperty(RDF.value, AbstractModelTestBase.tvString, lang)); } }
@Override public Object open(Assembler a, Resource root, Mode mode) { if (root.hasProperty(TextVocab.pUseAnalyzer)) { Statement useStmt = root.getProperty(TextVocab.pUseAnalyzer); Resource key = useStmt.getResource(); return Util.getDefinedAnalyzer(key); } return null; }
public static UpdateTest create(String testName, EarlReport earl, Resource entry, Resource action, Resource result) { if ( ! action.hasProperty(TestManifestUpdate_11.request) ) { System.err.println("No request in action: "+testName) ; return null ; } return new UpdateTest(testName, earl, entry, action, result) ; } private UpdateTest(String testName, EarlReport earl, Resource entry, Resource action, Resource result)
public void testString() { Assert.assertTrue(r.hasProperty(RDF.value, AbstractModelTestBase.tvString)); }
private static void setSimplePrefixes( Resource root, PrefixMapping result ) { if (root.hasProperty( JA.prefix )) { Literal prefix = getUniqueLiteral( root, JA.prefix ); Literal namespace = getUniqueLiteral( root, JA.namespace ); result.setNsPrefix( prefix.getLexicalForm(), namespace.getLexicalForm() ); } } }
@Override public void act(Resource r) { // if (r.getProperty(status).getString().equals(approved)) // if (r.getURI().endsWith("rdfms-xmllang/test004")) if (r.hasProperty(warning)) { addTest(r, new WarningTest(r)); } else { addTest(r, new PositiveTest(r)); } } });
private static void setSimplePrefixes( Resource root, PrefixMapping result ) { if (root.hasProperty( JA.prefix )) { Literal prefix = getUniqueLiteral( root, JA.prefix ); Literal namespace = getUniqueLiteral( root, JA.namespace ); result.setNsPrefix( prefix.getLexicalForm(), namespace.getLexicalForm() ); } } }
public static Resource getResource(Resource r, Property p) { if ( r == null ) return null ; if ( ! r.hasProperty(p) ) return null ; RDFNode n = r.getProperty(p).getObject() ; if ( n instanceof Resource ) return (Resource)n ; throw new TestException("Manifest problem (not a Resource): "+n+" => "+p) ; }
public static Resource getResource(Resource r, Property p) { if (r == null) return null; if (!r.hasProperty(p)) return null; RDFNode n = r.getProperty(p).getObject(); if (n instanceof Resource) return (Resource) n; throw new ManifestException("Manifest problem (not a Resource): " + n + " => " + p); }
public static String getLiteral(Resource r, Property p) { if (r == null) return null; if (!r.hasProperty(p)) return null; RDFNode n = r.getProperty(p).getObject(); if (n instanceof Literal) return ((Literal) n).getLexicalForm(); throw new ManifestException("Manifest problem (not a Literal): " + n + " => " + p); }