Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/vocabulary
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12051/src/org/mediavirus/graphl/vocabulary
Modified Files:
VocabularyRegistry.java SimpleVocabularyRegistry.java
Log Message:
- FEATURE: added z-index support for painting nodes & edges
- FEATURE: BoxNodePainter draws rounded rectangles
- FEATURE: Font for boxnodepainter is configurable
- FEATURE: labelcolor of edgepainter is configurable
- FEATURE: added utility functions for namespace compression/expansion
- REFACTOR: moved layouter to graphpane
- BUG: removed value property from graphelements
- BUG: stopping layouter when displaying contextmenus etc.
- BUG: fixed panning after startup
- removed obsolete commented-out code
Index: VocabularyRegistry.java
===================================================================
RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/vocabulary/VocabularyRegistry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** VocabularyRegistry.java 4 Oct 2004 10:21:01 -0000 1.2
--- VocabularyRegistry.java 14 Oct 2004 13:03:05 -0000 1.3
***************
*** 21,25 ****
public Enumeration getRegisteredVocabularies();
-
public void registerVocabulary(Vocabulary v);
}
\ No newline at end of file
--- 21,28 ----
public Enumeration getRegisteredVocabularies();
public void registerVocabulary(Vocabulary v);
+
+ public String expandNamespace(String uri);
+
+ public String compactNamespace(String uri);
}
\ No newline at end of file
Index: SimpleVocabularyRegistry.java
===================================================================
RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/vocabulary/SimpleVocabularyRegistry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SimpleVocabularyRegistry.java 4 Oct 2004 10:21:01 -0000 1.2
--- SimpleVocabularyRegistry.java 14 Oct 2004 13:03:05 -0000 1.3
***************
*** 6,11 ****
--- 6,14 ----
import java.util.Enumeration;
+ import java.util.Iterator;
import java.util.Vector;
+ import edu.unika.aifb.rdf.api.util.RDFUtil;
+
/**
* @author Flo Ledermann <led...@im...>
***************
*** 16,21 ****
Vector registeredVocabularies = new Vector();
! /*
! * Overrides @see org.mediavirus.graphl.vocabulary.VocabularyRegistry#getRegisteredVocabularies()
*/
public Enumeration getRegisteredVocabularies() {
--- 19,24 ----
Vector registeredVocabularies = new Vector();
! /**
! * @see org.mediavirus.graphl.vocabulary.VocabularyRegistry#getRegisteredVocabularies()
*/
public Enumeration getRegisteredVocabularies() {
***************
*** 23,28 ****
}
! /*
! * Overrides @see org.mediavirus.graphl.vocabulary.VocabularyRegistry#registerVocabulary(org.mediavirus.graphl.vocabulary.Vocabulary)
*/
public void registerVocabulary(Vocabulary v) {
--- 26,31 ----
}
! /**
! * @see org.mediavirus.graphl.vocabulary.VocabularyRegistry#registerVocabulary(org.mediavirus.graphl.vocabulary.Vocabulary)
*/
public void registerVocabulary(Vocabulary v) {
***************
*** 30,32 ****
--- 33,66 ----
}
+ /**
+ * @see org.mediavirus.graphl.vocabulary.VocabularyRegistry#expandNamespace(java.lang.String)
+ */
+ public String expandNamespace(String uri) {
+ int pos = uri.indexOf(':');
+ if (pos == -1) return uri;
+ String prefix = uri.substring(0,pos);
+ for (Iterator iter = registeredVocabularies.iterator(); iter.hasNext();) {
+ Vocabulary vocab = (Vocabulary) iter.next();
+ if (vocab.getDefaultNamespacePrefix().equals(prefix)) {
+ return vocab.getNamespace() + uri.substring(pos+1);
+ }
+ }
+ return uri;
+ }
+
+ /**
+ * @see org.mediavirus.graphl.vocabulary.VocabularyRegistry#compactNamespace(java.lang.String)
+ */
+ public String compactNamespace(String uri) {
+ String prefix = RDFUtil.guessNamespace(uri);
+ if (prefix == null) return uri;
+ for (Iterator iter = registeredVocabularies.iterator(); iter.hasNext();) {
+ Vocabulary vocab = (Vocabulary) iter.next();
+ if (vocab.getNamespace().equals(prefix)) {
+ return vocab.getDefaultNamespacePrefix() + ":" + RDFUtil.guessName(uri);
+ }
+ }
+ return uri;
+ }
+
}
|