@Override public boolean contains(Node g, Node s, Node p, Node o) { Graph graph = getGraph(g); if (graph != null) { return graph.contains(s, p, o); } else { return false; } }
public static boolean isContainer(Graph graph, Node container, Node containerType) { // if ( container.isLiteral() ) // return false ; if (containerType == null) return isContainer(graph, container, BAG) || isContainer(graph, container, ALT) || isContainer(graph, container, SEQ); return graph.contains(container, RDFtype, containerType); }
/** Return true if the given pattern occurs somewhere in the find sequence. */ @Override public boolean contains(TriplePattern pattern) { return graph.contains(pattern.getSubject(), pattern.getPredicate(), pattern.getObject()); }
/** Return true iff the node can be converted to an instance of this class (Thing) */ public boolean canWrap(Node n, EnhGraph eg) { Profile profile; if (eg instanceof OntModel) profile = ((OntModel) eg).getProfile(); else return false; if (!profile.isSupported(n, eg, Individual.class)) { return false; } Graph graph = eg.asGraph(); return graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.Thing.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.String.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.Phrase.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.Word.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.StopWord.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.Sentence.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.OffsetBasedString.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.ContextHashBasedString.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.Document.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.Topic.asNode()) || graph.contains( n, com.hp.hpl.jena.vocabulary.RDF.type.asNode(), eu.lod2.nlp2rdf.schema.tools.Vocabulary.Error.asNode()); }
/** * this is a simple-minded implementation of containsNode that uses find up to three times to * locate the node. Almost certainly particular graphs will be able to offer better query-handlers * ... */ public boolean containsNode(Node n) { return graph.contains(n, Node.ANY, Node.ANY) || graph.contains(Node.ANY, n, Node.ANY) || graph.contains(Node.ANY, Node.ANY, n); }