本文整理汇总了Java中com.hp.hpl.jena.util.iterator.ExtendedIterator类的典型用法代码示例。如果您正苦于以下问题:Java ExtendedIterator类的具体用法?Java ExtendedIterator怎么用?Java ExtendedIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExtendedIterator类属于com.hp.hpl.jena.util.iterator包,在下文中一共展示了ExtendedIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllClasses
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
public static List<String> getAllClasses ()
{
List<String>classes = new ArrayList<String>();
DrbCortexModel model;
try
{
model = DrbCortexModel.getDefaultModel();
}
catch (IOException e)
{
return classes;
}
ExtendedIterator it= model.getCortexModel().getOntModel().listClasses();
while (it.hasNext())
{
OntClass cl = (OntClass)it.next();
String uri = cl.getURI();
if (uri!=null)
classes.add(uri);
}
return classes;
}
示例2: prepareBindings
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
public BindingQueryPlan prepareBindings(GraphQuery q, Node[] variables) {
this.variables = variables;
this.indexes = new HashMap<Node,Integer>();
for (int i = 0; i < variables.length; i++) {
indexes.put(variables[i], new Integer(i));
}
BasicPattern pattern = new BasicPattern();
for (Triple t: q.getPattern()) {
pattern.add(t);
}
Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
final ExtendedIterator<Domain> queryIterator = new Map1Iterator<Binding,Domain>(new BindingToDomain(), plan.iterator());
return new BindingQueryPlan() {
public ExtendedIterator<Domain> executeBindings() {
return queryIterator;
}
};
}
示例3: prepareBindings
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
public BindingQueryPlan prepareBindings(Query q, Node[] variables) {
this.variables = variables;
this.indexes = new HashMap<Node,Integer>();
for (int i = 0; i < variables.length; i++) {
indexes.put(variables[i], new Integer(i));
}
BasicPattern pattern = new BasicPattern();
for (Triple t: q.getPattern()) {
pattern.add(t);
}
Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
final ExtendedIterator<Domain> queryIterator = new Map1Iterator<Binding,Domain>(new BindingToDomain(), plan.iterator());
return new BindingQueryPlan() {
public ExtendedIterator<Domain> executeBindings() {
return queryIterator;
}
};
}
示例4: getClassLabels
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
/**
* If class has a label AbraCadabraQualityPerformance --> Abra Cadabra --> abra cadabra : will be returned as a label in the set.
*
* @param ocls
* @return
*/
public Set<String> getClassLabels(OntClass ocls) {
String name = ocls.getLocalName();
ExtendedIterator<RDFNode> iterator = ocls.listLabels(null);
List<String> labels = new ArrayList<String>(3);
while (iterator.hasNext()) {
labels.add(iterator.next().asLiteral().getLexicalForm());
}
// get trimmed name,labels then split camel case.
name = trimName(name);
name = LingUtil.splitCamelCase(name).toLowerCase();
for (int i = 0; i < labels.size(); i++) {
labels.set(i, LingUtil.splitCamelCase(trimName(labels.get(i))).toLowerCase());//trim then split camel case . then make lowercase
}
Set<String> lbls = new HashSet<String>(3);
lbls.add(name);
lbls.addAll(labels);
return lbls;
}
示例5: getChildFeatures
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
public Set<FeatureClass> getChildFeatures(boolean direct) {
if (direct == false) {
Set<FeatureClass> decendatns = null;
ExtendedIterator<OntClass> children = f.listSubClasses(false);
if (children.hasNext()) {
decendatns = new HashSet<FeatureClass>(15);
}
while (children.hasNext()) {
decendatns.add(new FeatureClass(children.next()));
}
return decendatns;
}
return cfs;
}
示例6: getProduct
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
public static Product getProduct(Node subject,Graph graph,HashMap<Node,Product> hashmap){
Product product=hashmap.get(subject);
if (product!=null){
return product;
}
else{
product=new Product();
ExtendedIterator<Node> compositions=GraphUtil.listSubjects(graph,RELATING_OBJECT,subject);
if(compositions.hasNext()){
ExtendedIterator<Node> childIterator=GraphUtil.listObjects(graph,compositions.next(),RELATED_OBJECTS);
while (childIterator.hasNext()){
Node childNode=childIterator.next();
Product child=hashmap.get(childNode);
if (child!=null){
product.getTriangles().addAll(child.getTriangles());
}
else{
child=getProduct(childNode,graph,hashmap);
product.getTriangles().addAll(child.getTriangles());
}
}
}
return product;
}
}
示例7: getRelatedSubjects
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Override
protected HashSet<Node> getRelatedSubjects(Node node, ExecutionContext execCxt) {
HashSet<Node> results = new HashSet<Node>();
Graph graph = execCxt.getActiveGraph();
Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
LinkedList<Storey> storeys = new LinkedList<Storey>();
if (graph.contains(node, RDF.type.asNode(), clazz)) {
Storey storey = new Storey(node, elevation(node, graph));
ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
while (triples.hasNext()) {
Node subject = triples.next().getSubject();
Storey s = new Storey(subject, elevation(subject, graph));
if (s.elevation > storey.elevation) {
addStorey(storeys, s, graph);
}
}
if (storeys.size() > 0) {
results.add(storeys.get(0).storey);
}
}
return results;
}
示例8: getRelatedObjects
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Override
protected HashSet<Node> getRelatedObjects(Node node, ExecutionContext execCxt) {
HashSet<Node> results = new HashSet<Node>();
Graph graph = execCxt.getActiveGraph();
Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
LinkedList<Storey> storeys = new LinkedList<Storey>();
if (graph.contains(node, RDF.type.asNode(), clazz)) {
Storey storey = new Storey(node, elevation(node, graph));
ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
while (triples.hasNext()) {
Node subject = triples.next().getSubject();
Storey s = new Storey(subject, elevation(subject, graph));
if (s.elevation < storey.elevation) {
addStorey(storeys, s, graph);
}
}
if (storeys.size() > 0) {
results.add(storeys.get(storeys.size() - 1).storey);
}
}
return results;
}
示例9: graphBaseFind
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Override
protected ExtendedIterator<Triple> graphBaseFind(TripleMatch tm)
{
try
{
// this is very odd behavior -- clean up a bit
return context.find(
tm.getMatchSubject() != null ? tm.getMatchSubject() : ((Triple)tm).getSubject(),
tm.getMatchPredicate() != null ? tm.getMatchPredicate() : ((Triple)tm).getPredicate(),
tm.getMatchObject() != null ? tm.getMatchObject() : ((Triple)tm).getObject());
}
catch (IOException e)
{
log.error("", e);
throw new QueryException(e);
}
}
示例10: extractResourceURIs
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
private <T> List<String> extractResourceURIs(final ExtendedIterator<T> iterator, final Set<String> namespaces) {
try {
final List<String> uris=Lists.newLinkedList();
while(iterator.hasNext()) {
final T item=iterator.next();
if(item instanceof Resource) {
final Resource resource = (Resource)item;
if(!resource.isAnon()) {
final String uri = resource.getURI();
if(!isReserved(uri)) {
if(namespaces.contains(resource.getNameSpace())) {
uris.add(uri);
}
}
}
}
}
return uris;
} finally {
iterator.close();
}
}
示例11: getSha1
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
/**
* @return the sha1
* @throws InvalidSPDXAnalysisException
*/
public String getSha1() throws InvalidSPDXAnalysisException {
String retval = null;
Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_CHECKSUM).asNode();
Triple m = Triple.createMatch(this.node, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
SPDXChecksum cksum = new SPDXChecksum(model, t.getObject());
if (cksum.getAlgorithm().equals(SpdxRdfConstants.ALGORITHM_SHA1)) {
retval = cksum.getValue();
}
}
return retval;
}
示例12: getDeclaredLicense
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
/**
* @return the declaredLicenses
* @throws InvalidSPDXAnalysisException
*/
public SPDXLicenseInfo getDeclaredLicense() throws InvalidSPDXAnalysisException {
ArrayList<SPDXLicenseInfo> alLic = new ArrayList<SPDXLicenseInfo>();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_DECLARED_LICENSE).asNode();
Triple m = Triple.createMatch(this.node, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
alLic.add(SPDXLicenseInfoFactory.getLicenseInfoFromModel(model, t.getObject()));
}
if (alLic.size() > 1) {
throw(new InvalidSPDXAnalysisException("Too many declared licenses"));
}
if (alLic.size() == 0) {
return null;
}
return alLic.get(0);
}
示例13: getConcludedLicenses
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
/**
* @return the detectedLicenses
* @throws InvalidSPDXAnalysisException
*/
public SPDXLicenseInfo getConcludedLicenses() throws InvalidSPDXAnalysisException {
ArrayList<SPDXLicenseInfo> alLic = new ArrayList<SPDXLicenseInfo>();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_CONCLUDED_LICENSE).asNode();
Triple m = Triple.createMatch(this.node, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
alLic.add(SPDXLicenseInfoFactory.getLicenseInfoFromModel(model, t.getObject()));
}
if (alLic.size() > 1) {
throw(new InvalidSPDXAnalysisException("Too many concluded licenses"));
}
if (alLic.size() == 0) {
return null;
}
return alLic.get(0);
}
示例14: findDocPropertieStringValues
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
/**
* Find all property string values belonging to the subject
* @param subject
* @param nameSpace
* @param propertyName
* @return string values of the properties or null if the subject or propertyName is null
*/
private String[] findDocPropertieStringValues(Node subject, String nameSpace, String propertyName) {
if (subject == null || propertyName == null) {
return null;
}
ArrayList<String> alResult = new ArrayList<String>();
Node p = model.getProperty(nameSpace, propertyName).asNode();
Triple m = Triple.createMatch(subject, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
if (t.getObject().isURI()) {
if (t.getObject().getURI().equals(SpdxRdfConstants.URI_VALUE_NONE)) {
alResult.add(SpdxRdfConstants.NONE_VALUE);
} else if (t.getObject().getURI().equals(SpdxRdfConstants.URI_VALUE_NOASSERTION)) {
alResult.add(SpdxRdfConstants.NOASSERTION_VALUE);
} else {
alResult.add(t.getObject().toString(false));
}
} else {
alResult.add(t.getObject().toString(false));
}
}
String[] retval = new String[alResult.size()];
return alResult.toArray(retval);
}
示例15: getDataLicense
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
public SPDXStandardLicense getDataLicense() throws InvalidSPDXAnalysisException {
ArrayList<SPDXLicenseInfo> alLic = new ArrayList<SPDXLicenseInfo>();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_DATA_LICENSE).asNode();
Triple m = Triple.createMatch(getSpdxDocNode(), p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
alLic.add(SPDXLicenseInfoFactory.getLicenseInfoFromModel(model, t.getObject()));
}
if (alLic.size() > 1) {
throw(new InvalidSPDXAnalysisException("Too many data licenses"));
}
if (alLic.size() == 0) {
return null;
}
if (!(alLic.get(0) instanceof SPDXStandardLicense)) {
throw(new InvalidSPDXAnalysisException("Incorrect license for datalicense - must be a standard SPDX license type"));
}
return (SPDXStandardLicense)(alLic.get(0));
}