Java Code Examples for org.eclipse.rdf4j.model.Statement#getObject()
The following examples show how to use
org.eclipse.rdf4j.model.Statement#getObject() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryConfigUtil.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Deprecated public static Set<String> getRepositoryIDs(Repository repository) throws RepositoryException { try (RepositoryConnection con = repository.getConnection()) { Set<String> idSet = new LinkedHashSet<>(); try (RepositoryResult<Statement> idStatementIter = con.getStatements(null, REPOSITORYID, null, true)) { while (idStatementIter.hasNext()) { Statement idStatement = idStatementIter.next(); if (idStatement.getObject() instanceof Literal) { Literal idLiteral = (Literal) idStatement.getObject(); idSet.add(idLiteral.getLabel()); } } } return idSet; } }
Example 2
Source File: ForwardChainingRDFSInferencerConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
private int applyRuleRdfs4b() throws SailException { int nofInferred = 0; Iterable<Statement> iter = newThisIteration.getStatements(null, null, null); for (Statement st : iter) { Value uuu = st.getObject(); if (uuu instanceof Resource) { boolean added = addInferredStatement((Resource) uuu, RDF.TYPE, RDFS.RESOURCE); if (added) { nofInferred++; } } } return nofInferred; }
Example 3
Source File: Models.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
private static List<Statement> findMatchingStatements(Statement st, Model model, Map<Resource, Resource> bNodeMapping) { Resource s = isBlank(st.getSubject()) ? null : st.getSubject(); IRI p = st.getPredicate(); Value o = isBlank(st.getObject()) ? null : st.getObject(); Resource[] g = isBlank(st.getContext()) ? new Resource[0] : new Resource[] { st.getContext() }; List<Statement> result = new ArrayList<>(); for (Statement modelSt : model.filter(s, p, o, g)) { if (statementsMatch(st, modelSt, bNodeMapping)) { // All components possibly match result.add(modelSt); } } return Collections.unmodifiableList(result); }
Example 4
Source File: GeoWaveGeoIndexer.java From rya with Apache License 2.0 | 6 votes |
@Override public void storeStatements(final Collection<RyaStatement> ryaStatements) throws IOException { // create a feature collection final DefaultFeatureCollection featureCollection = new DefaultFeatureCollection(); for (final RyaStatement ryaStatement : ryaStatements) { final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement); // if the predicate list is empty, accept all predicates. // Otherwise, make sure the predicate is on the "valid" list final boolean isValidPredicate = validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate()); if (isValidPredicate && (statement.getObject() instanceof Literal)) { try { final SimpleFeature feature = createFeature(featureType, statement); featureCollection.add(feature); } catch (final ParseException e) { logger.warn("Error getting geo from statement: " + statement.toString(), e); } } } // write this feature collection to the store if (!featureCollection.isEmpty()) { featureStore.addFeatures(featureCollection); } }
Example 5
Source File: LuceneSailConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void statementAdded(Statement statement) { // we only consider statements that contain literals if (statement.getObject() instanceof Literal) { statement = sail.mapStatement(statement); if (statement == null) { return; } // we further only index statements where the Literal's datatype is // accepted Literal literal = (Literal) statement.getObject(); if (luceneIndex.accept(literal)) { buffer.add(statement); } } }
Example 6
Source File: LuceneSailConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void statementRemoved(Statement statement) { // we only consider statements that contain literals if (statement.getObject() instanceof Literal) { statement = sail.mapStatement(statement); if (statement == null) { return; } // we further only indexed statements where the Literal's datatype // is accepted Literal literal = (Literal) statement.getObject(); if (luceneIndex.accept(literal)) { buffer.remove(statement); } } }
Example 7
Source File: AbstractNQuadsParserUnitTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Tests N-Quads parsing with literal and language. */ @Test public void testParseBasicLiteralLang() throws RDFHandlerException, IOException, RDFParseException { final ByteArrayInputStream bais = new ByteArrayInputStream( "<http://www.v/dat/4b2-21> <http://www.w3.org/20/ica#dtend> \"2010-05-02\"@en <http://sin.siteserv.org/def/>." .getBytes()); final TestRDFHandler rdfHandler = new TestRDFHandler(); parser.setRDFHandler(rdfHandler); parser.parse(bais, "http://test.base.uri"); final Statement statement = rdfHandler.getStatements().iterator().next(); Assert.assertEquals("http://www.v/dat/4b2-21", statement.getSubject().stringValue()); Assert.assertEquals("http://www.w3.org/20/ica#dtend", statement.getPredicate().stringValue()); Assert.assertTrue(statement.getObject() instanceof Literal); Literal object = (Literal) statement.getObject(); Assert.assertEquals("2010-05-02", object.stringValue()); Assert.assertEquals("en", object.getLanguage().orElse(null)); Assert.assertEquals(RDF.LANGSTRING, object.getDatatype()); Assert.assertEquals("http://sin.siteserv.org/def/", statement.getContext().stringValue()); }
Example 8
Source File: HBaseSail.java From Halyard with Apache License 2.0 | 6 votes |
@Override public void initialize() throws SailException { //initialize the SAIL try { //get or create and get the HBase table table = HalyardTableUtils.getTable(config, tableName, create, splitBits); //Iterate over statements relating to namespaces and add them to the namespace map. try (CloseableIteration<? extends Statement, SailException> nsIter = getStatements(null, HALYARD.NAMESPACE_PREFIX_PROPERTY, null, true)) { while (nsIter.hasNext()) { Statement st = nsIter.next(); if (st.getObject() instanceof Literal) { String prefix = st.getObject().stringValue(); String name = st.getSubject().stringValue(); namespaces.put(prefix, new SimpleNamespace(prefix, name)); } } } } catch (IOException ex) { throw new SailException(ex); } }
Example 9
Source File: ForwardChainingRDFSInferencerConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
private int applyRuleRdfs7_2() throws SailException { int nofInferred = 0; Iterable<Statement> ntIter = newThisIteration.getStatements(null, RDFS.SUBPROPERTYOF, null); for (Statement nt : ntIter) { Resource aaa = nt.getSubject(); Value bbb = nt.getObject(); if (aaa instanceof IRI && bbb instanceof IRI) { CloseableIteration<? extends Statement, SailException> t1Iter; t1Iter = getWrappedConnection().getStatements(null, (IRI) aaa, null, true); while (t1Iter.hasNext()) { Statement t1 = t1Iter.next(); Resource xxx = t1.getSubject(); Value yyy = t1.getObject(); boolean added = addInferredStatement(xxx, (IRI) bbb, yyy); if (added) { nofInferred++; } } t1Iter.close(); } } return nofInferred; }
Example 10
Source File: JSONLDInternalRDFParser.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void handleStatement(RDFDataset result, Statement nextStatement) { // TODO: from a basic look at the code it seems some of these could be // null // null values for IRIs will probably break things further down the line // and i'm not sure yet if this should be something handled later on, or // something that should be checked here final String subject = getResourceValue(nextStatement.getSubject()); final String predicate = getResourceValue(nextStatement.getPredicate()); final Value object = nextStatement.getObject(); final String graphName = getResourceValue(nextStatement.getContext()); if (object instanceof Literal) { final Literal literal = (Literal) object; final String value = literal.getLabel(); String datatype = getResourceValue(literal.getDatatype()); // In RDF-1.1, Language Literals internally have the datatype // rdf:langString if (literal.getLanguage().isPresent() && datatype == null) { datatype = RDF.LANGSTRING.stringValue(); } // In RDF-1.1, RDF-1.0 Plain Literals are now Typed Literals with // type xsd:String if (!literal.getLanguage().isPresent() && datatype == null) { datatype = XMLSchema.STRING.stringValue(); } result.addQuad(subject, predicate, value, datatype, literal.getLanguage().orElse(null), graphName); } else { result.addQuad(subject, predicate, getResourceValue((Resource) object), graphName); } }
Example 11
Source File: RyaDaoQueryWrapper.java From rya with Apache License 2.0 | 5 votes |
/** * Handles only the first result of a query. Closes the query iterator when * done. * @param statement the {@link Statement} to query for. (not {@code null}) * @param rdfStatementHandler the {@link RDFHandler} to use for handling the * first statement returned. (not {@code null}) * @throws QueryEvaluationException */ public void queryFirst(final Statement statement, final RDFHandler rdfStatementHandler) throws QueryEvaluationException { checkNotNull(statement); final Resource subject = statement.getSubject(); final IRI predicate = statement.getPredicate(); final Value object = statement.getObject(); final Resource context = statement.getContext(); queryFirst(subject, predicate, object, rdfStatementHandler, context); }
Example 12
Source File: ForwardChainingRDFSInferencerConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
private int applyRuleRdfs2_2() throws SailException { int nofInferred = 0; Iterable<Statement> ntIter = newThisIteration.getStatements(null, RDFS.DOMAIN, null); for (Statement nt : ntIter) { Resource aaa = nt.getSubject(); Value zzz = nt.getObject(); if (aaa instanceof IRI && zzz instanceof Resource) { CloseableIteration<? extends Statement, SailException> t1Iter; t1Iter = getWrappedConnection().getStatements(null, (IRI) aaa, null, true); while (t1Iter.hasNext()) { Statement t1 = t1Iter.next(); Resource xxx = t1.getSubject(); boolean added = addInferredStatement(xxx, RDF.TYPE, zzz); if (added) { nofInferred++; } } t1Iter.close(); } } return nofInferred; }
Example 13
Source File: ForwardChainingRDFSInferencerConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
private int applyRuleRdfs9_2() throws SailException { int nofInferred = 0; Iterable<Statement> ntIter = newThisIteration.getStatements(null, RDF.TYPE, null); for (Statement nt : ntIter) { Resource aaa = nt.getSubject(); Value xxx = nt.getObject(); if (xxx instanceof Resource) { CloseableIteration<? extends Statement, SailException> t1Iter; t1Iter = getWrappedConnection().getStatements((Resource) xxx, RDFS.SUBCLASSOF, null, true); while (t1Iter.hasNext()) { Statement t1 = t1Iter.next(); Value yyy = t1.getObject(); if (yyy instanceof Resource) { boolean added = addInferredStatement(aaa, RDF.TYPE, yyy); if (added) { nofInferred++; } } } t1Iter.close(); } } return nofInferred; }
Example 14
Source File: AccumuloTemporalIndexer.java From rya with Apache License 2.0 | 5 votes |
private void deleteStatement(final Statement statement) throws IOException, IllegalArgumentException { Objects.requireNonNull(temporalIndexBatchWriter,"This is not initialized for writing. Must call setMultiTableBatchWriter() and init()."); // if the predicate list is empty, accept all predicates. // Otherwise, make sure the predicate is on the "valid" list final boolean isValidPredicate = validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate()); if (!isValidPredicate || !(statement.getObject() instanceof Literal)) { return; } final DateTime[] indexDateTimes = new DateTime[2]; // 0 begin, 1 end of interval extractDateTime(statement, indexDateTimes); if (indexDateTimes[0] == null) { return; } // Remove this as an instant, or interval. try { if (indexDateTimes[1] != null) { final TemporalInterval interval = new TemporalInterval(new TemporalInstantRfc3339(indexDateTimes[0]), new TemporalInstantRfc3339(indexDateTimes[1])); removeInterval(temporalIndexBatchWriter, interval, statement); } else { final TemporalInstant instant = new TemporalInstantRfc3339(indexDateTimes[0]); removeInstant(temporalIndexBatchWriter, instant, statement); } } catch (final MutationsRejectedException e) { throw new IOException("While adding interval/instant for statement =" + statement, e); } }
Example 15
Source File: GeoMesaGeoIndexer.java From rya with Apache License 2.0 | 5 votes |
private void deleteStatements(final Collection<RyaStatement> ryaStatements) throws IOException { // create a feature collection final DefaultFeatureCollection featureCollection = new DefaultFeatureCollection(); for (final RyaStatement ryaStatement : ryaStatements) { final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement); // if the predicate list is empty, accept all predicates. // Otherwise, make sure the predicate is on the "valid" list final boolean isValidPredicate = validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate()); if (isValidPredicate && (statement.getObject() instanceof Literal)) { try { final SimpleFeature feature = createFeature(featureType, statement); featureCollection.add(feature); } catch (final ParseException e) { logger.warn("Error getting geo from statement: " + statement.toString(), e); } } } // remove this feature collection from the store if (!featureCollection.isEmpty()) { final Set<Identifier> featureIds = new HashSet<Identifier>(); final FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null); final Set<String> stringIds = DataUtilities.fidSet(featureCollection); for (final String id : stringIds) { featureIds.add(filterFactory.featureId(id)); } final Filter filter = filterFactory.id(featureIds); featureStore.removeFeatures(filter); } }
Example 16
Source File: Schema.java From rya with Apache License 2.0 | 4 votes |
/** * Incorporate a new triple into the schema. */ public void processTriple(Statement triple) { Resource s = triple.getSubject(); IRI p = triple.getPredicate(); Value o = triple.getObject(); if (isSchemaTriple(triple)) { // For a type statement to be schema information, it must yield // some boolean information about a property. if (p.equals(RDF.TYPE)) { if (schemaTypes.contains(o)) { addPropertyType((IRI) s, (Resource) o); } } // Domain/range else if (p.equals(RDFS.DOMAIN)) { // Don't add trivial domain owl:Thing if (!o.equals(OWL.THING)) { getProperty(s).addDomain(getClass(o)); } } else if (p.equals(RDFS.RANGE)) { // Don't add trivial range owl:Thing if (!o.equals(OWL.THING)) { getProperty(s).addRange(getClass(o)); } } // Sub/super relations else if (p.equals(RDFS.SUBCLASSOF)) { // Everything is a subclass of owl#Thing, we don't need to // store that information if (!o.equals(OWL.THING)) { getClass(s).addSuperClass(getClass(o)); } } else if (p.equals(RDFS.SUBPROPERTYOF)) { getProperty(s).addSuperProperty(getProperty(o)); } // Equivalence relations else if (p.equals(OWL.EQUIVALENTCLASS)) { getClass(s).addEquivalentClass(getClass(o)); } else if (p.equals(OWL.EQUIVALENTPROPERTY)) { getProperty(s).addEquivalentProperty(getProperty(o)); } // Inverse properties else if (p.equals(OWL.INVERSEOF)) { getProperty(s).addInverse(getProperty(o)); getProperty(o).addInverse(getProperty(s)); } // Complementary classes else if (p.equals(OWL.COMPLEMENTOF)) { getClass(s).addComplement(getClass(o)); getClass(o).addComplement(getClass(s)); } // Disjoint classes and properties else if (p.equals(OWL.DISJOINTWITH)) { getClass(s).addDisjoint(getClass(o)); getClass(o).addDisjoint(getClass(s)); } else if (p.equals(OWL2.PROPERTYDISJOINTWITH)) { getProperty(s).addDisjoint(getProperty(o)); getProperty(o).addDisjoint(getProperty(s)); } // Property restriction info else if (p.equals(OWL.ONPROPERTY)) { getClass(s).addProperty(getProperty(o)); } else if (p.equals(OWL.SOMEVALUESFROM)) { getClass(s).addSvf(getClass(o)); } else if (p.equals(OWL.ALLVALUESFROM)) { getClass(s).addAvf(getClass(o)); } else if (p.equals(OWL2.ONCLASS)) { getClass(s).addClass(getClass(o)); } else if (p.equals(OWL.HASVALUE)) { getClass(s).addValue(o); } else if (p.equals(OWL.MAXCARDINALITY)) { getClass(s).setMaxCardinality(o); } else if (p.equals(OWL2.MAXQUALIFIEDCARDINALITY)) { getClass(s).setMaxQualifiedCardinality(o); } } }
Example 17
Source File: InferenceEngine.java From rya with Apache License 2.0 | 4 votes |
/** * Add unions to the subclass graph: if c owl:unionOf LIST(c1, c2, ... cn), * then any instances of c1, c2, ... or cn are also instances of c, meaning * c is a superclass of all the rest. * (In principle, an instance of c is likewise implied to be at least one of * the other types, but this fact is ignored for now to avoid * nondeterministic reasoning.) * @param graph the {@link Graph} to add to. * @throws QueryEvaluationException */ private void addUnions(final Graph graph) throws QueryEvaluationException { final CloseableIteration<Statement, QueryEvaluationException> iter = RyaDAOHelper.query(ryaDAO, null, OWL.UNIONOF, null, conf); try { while (iter.hasNext()) { final Statement st = iter.next(); final Value unionType = st.getSubject(); // Traverse the list of types constituting the union Value current = st.getObject(); while (current instanceof Resource && !RDF.NIL.equals(current)) { final Resource listNode = (Resource) current; CloseableIteration<Statement, QueryEvaluationException> listIter = RyaDAOHelper.query(ryaDAO, listNode, RDF.FIRST, null, conf); try { if (listIter.hasNext()) { final Statement firstStatement = listIter.next(); if (firstStatement.getObject() instanceof Resource) { final Resource subclass = (Resource) firstStatement.getObject(); final Statement subclassStatement = VF.createStatement(subclass, RDFS.SUBCLASSOF, unionType); addStatementEdge(graph, RDFS.SUBCLASSOF.stringValue(), subclassStatement); } } } finally { listIter.close(); } listIter = RyaDAOHelper.query(ryaDAO, listNode, RDF.REST, null, conf); try { if (listIter.hasNext()) { current = listIter.next().getObject(); } else { current = RDF.NIL; } } finally { listIter.close(); } } } } finally { if (iter != null) { iter.close(); } } }
Example 18
Source File: HalyardStats.java From Halyard with Apache License 2.0 | 4 votes |
@Override protected void map(ImmutableBytesWritable key, Result value, Context output) throws IOException, InterruptedException { byte region = key.get()[key.getOffset()]; List<Statement> stmts = null; int hashShift; if (region < HalyardTableUtils.CSPO_PREFIX) { hashShift = 1; } else { hashShift = HalyardTableUtils.KEY_SIZE + 1; if (!matchAndCopyKey(key.get(), key.getOffset() + 1, lastCtxFragment) || region != lastRegion) { cleanup(output); stmts = HalyardTableUtils.parseStatements(value, ssf); graph = (IRI) stmts.get(0).getContext(); } if (update && region == HalyardTableUtils.CSPO_PREFIX) { if (Arrays.equals(statsContextHash, lastCtxFragment)) { if (sail == null) { Configuration conf = output.getConfiguration(); sail = new HBaseSail(conf, conf.get(SOURCE), false, 0, true, 0, null, null); sail.initialize(); } if (stmts == null) { stmts = HalyardTableUtils.parseStatements(value, ssf); } for (Statement st : stmts) { if (statsContext.equals(st.getContext()) && matchingGraphContext(st.getSubject())) { sail.removeStatement(null, st.getSubject(), st.getPredicate(), st.getObject(), st.getContext()); removed++; } } lastRegion = region; return; //do no count removed statements } } } boolean hashChange = !matchAndCopyKey(key.get(), key.getOffset() + hashShift, lastKeyFragment) || region != lastRegion || lastGraph != graph; if (hashChange) { cleanupSubset(output); if (stmts == null) { stmts = HalyardTableUtils.parseStatements(value, ssf); } Statement stmt = stmts.get(0); switch (region) { case HalyardTableUtils.SPO_PREFIX: case HalyardTableUtils.CSPO_PREFIX: distinctSubjects++; Resource subj = stmt.getSubject(); if (subj instanceof IRI) { distinctIRIReferenceSubjects++; } else { distinctBlankNodeSubjects++; } subsetType = VOID_EXT.SUBJECT; subsetId = subj; break; case HalyardTableUtils.POS_PREFIX: case HalyardTableUtils.CPOS_PREFIX: properties++; subsetType = VOID.PROPERTY; subsetId = stmt.getPredicate(); break; case HalyardTableUtils.OSP_PREFIX: case HalyardTableUtils.COSP_PREFIX: distinctObjects++; Value obj = stmt.getObject(); if (obj instanceof IRI) { distinctIRIReferenceObjects++; } else if (obj instanceof BNode) { distinctBlankNodeObjects++; } else { distinctLiterals++; } subsetType = VOID_EXT.OBJECT; subsetId = obj; break; default: throw new IOException("Unknown region #" + region); } } switch (region) { case HalyardTableUtils.SPO_PREFIX: case HalyardTableUtils.CSPO_PREFIX: triples += value.rawCells().length; break; case HalyardTableUtils.POS_PREFIX: case HalyardTableUtils.CPOS_PREFIX: if (Arrays.equals(TYPE_HASH, lastKeyFragment) && (!matchAndCopyKey(key.get(), key.getOffset() + hashShift + HalyardTableUtils.KEY_SIZE, lastClassFragment) || hashChange)) { classes++; } break; default: } subsetCounter += value.rawCells().length; setCounter += value.rawCells().length; lastRegion = region; lastGraph = graph; if ((counter++ % 100000) == 0) { output.setStatus(MessageFormat.format("reg:{0} {1} t:{2} s:{3} p:{4} o:{5} c:{6} r:{7}", region, counter, triples, distinctSubjects, properties, distinctObjects, classes, removed)); } }
Example 19
Source File: SPARQLConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 4 votes |
private void createDataBody(StringBuilder qb, Iterable<? extends Statement> statements, boolean ignoreContext) { for (Statement st : statements) { final Resource context = st.getContext(); if (!ignoreContext) { if (context != null) { String namedGraph = context.stringValue(); if (context instanceof BNode) { // SPARQL does not allow blank nodes as named graph // identifiers, so we need to skolemize // the blank node id. namedGraph = "urn:nodeid:" + context.stringValue(); } qb.append(" GRAPH <" + namedGraph + "> { \n"); } } if (st.getSubject() instanceof BNode) { qb.append("_:" + st.getSubject().stringValue() + " "); } else { qb.append("<" + st.getSubject().stringValue() + "> "); } qb.append("<" + st.getPredicate().stringValue() + "> "); if (st.getObject() instanceof Literal) { Literal lit = (Literal) st.getObject(); qb.append("\""); qb.append(SPARQLUtil.encodeString(lit.getLabel())); qb.append("\""); if (Literals.isLanguageLiteral(lit)) { qb.append("@"); qb.append(lit.getLanguage().get()); } else { qb.append("^^<" + lit.getDatatype().stringValue() + ">"); } qb.append(" "); } else if (st.getObject() instanceof BNode) { qb.append("_:" + st.getObject().stringValue() + " "); } else { qb.append("<" + st.getObject().stringValue() + "> "); } qb.append(". \n"); if (!ignoreContext && context != null) { qb.append(" }\n"); } } }
Example 20
Source File: Schema.java From rya with Apache License 2.0 | 4 votes |
/** * Determine whether a fact is contained in the Schema object * relationships or implied by schema rules. * @return True if this schema contains the semantics of the triple */ public boolean containsTriple(Statement triple) { // The schema certainly doesn't contain it if it's not a // schema-relevant triple at all. if (isSchemaTriple(triple)) { Resource s = triple.getSubject(); IRI p = triple.getPredicate(); Value o = triple.getObject(); // If this is telling us something about a property: if (properties.containsKey(s)) { OwlProperty prop = properties.get(s); // Property types: if (p.equals(RDF.TYPE)) { if ((o.equals(OWL.TRANSITIVEPROPERTY) && prop.isTransitive()) || (o.equals(OWL2.IRREFLEXIVEPROPERTY) && prop.isIrreflexive()) || (o.equals(OWL.SYMMETRICPROPERTY) && prop.isSymmetric()) || (o.equals(OWL2.ASYMMETRICPROPERTY) && prop.isAsymmetric()) || (o.equals(OWL.FUNCTIONALPROPERTY) && prop.isFunctional()) || (o.equals(OWL.INVERSEFUNCTIONALPROPERTY) && prop.isInverseFunctional())) { return true; } } // Relationships with other properties: if ((p.equals(RDFS.SUBPROPERTYOF) && prop.getSuperProperties().contains(o)) || (p.equals(OWL2.PROPERTYDISJOINTWITH) && prop.getDisjointProperties().contains(o)) || (p.equals(OWL.EQUIVALENTPROPERTY) && prop.getEquivalentProperties().contains(o)) || (p.equals(OWL.INVERSEOF) && prop.getInverseProperties().contains(o))) { return true; } // Relationships with classes: if ((p.equals(RDFS.DOMAIN) && prop.getDomain().contains(o)) || (p.equals(RDFS.RANGE) && prop.getRange().contains(o))) { return true; } } // If this is about a class relationship: if (classes.containsKey(s)) { OwlClass subject = classes.get(s); if ((p.equals(OWL.EQUIVALENTCLASS) && (subject.getEquivalentClasses().contains(o))) || (p.equals(OWL.DISJOINTWITH) && (subject.getDisjointClasses().contains(o))) || (p.equals(OWL.COMPLEMENTOF) && (subject.getComplementaryClasses().contains(o))) || (p.equals(RDFS.SUBCLASSOF) && (subject.getSuperClasses().contains(o)))) { return true; } } } return false; }