1 19 20 package com.hp.hpl.jena.ontology.impl; 23 24 25 import com.hp.hpl.jena.enhanced.*; 28 import com.hp.hpl.jena.graph.Node; 29 import com.hp.hpl.jena.ontology.*; 30 import com.hp.hpl.jena.rdf.model.Property; 31 32 33 42 public class UnionClassImpl 43 extends BooleanClassDescriptionImpl 44 implements UnionClass 45 { 46 49 52 57 public static Implementation factory = new Implementation() { 58 public EnhNode wrap( Node n, EnhGraph eg ) { 59 if (canWrap( n, eg )) { 60 return new UnionClassImpl( n, eg ); 61 } 62 else { 63 throw new ConversionException( "Cannot convert node " + n + " to UnionClass"); 64 } 65 } 66 67 public boolean canWrap( Node node, EnhGraph eg ) { 68 Profile profile = (eg instanceof OntModel) ? ((OntModel) eg).getProfile() : null; 70 Property union = (profile == null) ? null : profile.UNION_OF(); 71 72 return (profile != null) && 73 profile.isSupported( node, eg, OntClass.class ) && 74 union != null && 75 eg.asGraph().contains( node, union.getNode(), Node.ANY ); 76 } 77 }; 78 79 80 83 86 94 public UnionClassImpl( Node n, EnhGraph g ) { 95 super( n, g ); 96 } 97 98 99 102 public Property operator() {return getProfile().UNION_OF();} 103 public String getOperatorName() {return "UNION_OF";} 104 105 106 109 113 } 114 115 116 145 146 147 | Popular Tags |